Default to Current Week

How can I set up a card to default to the current week?

Basically I have data with the Week Number in . I want to the card to automatically open in the current week we are in.

 

For example. This week (week commencing 14th October (from sunday)) is week 42 so I want my card to open from week 42

 

Any help would be appreciated.

Best Answer

  • Property_Ninja
    Accepted Answer

    In this situation you would have to write a beastmode and filter on it.

     

    CASE WHEN `Actual Year` = YEAR(CURRENT_DATE) AND `Act Week` = WEEK(CURRENT_DATE,0) THEN 'True' ELSE 'False' END

     

    Then you would bring this into your filter and select 'True'

     

    Thanks,

     

    Brian

Answers

  • Hi SiGill1979,

     

    You should be able to accomplish this by choosing the "This Week" option in the "Date Range" section of your card. Please see the attachment.

     

    Hope this helps,

     

    Brian

  • hanks for this. although my data doesn't have a date in it, just year and week number.

    Please see attachment

  • Thats looks perfect

     

    Thank you for your help

  • Great thanks, and if you wanted to use the "Date Range" function to be more dynamic and allow users to change the week while viewing the card, you could write a beastmode like this ...

     

    STR_TO_DATE(CONCAT(`Actual Year`,' ',`Act Week`,' Sunday'),'%X %V %W')

     

    This will create a date based on the year and week, assuming your start of week is Sunday. Then you can use this newly created beastmode in the "Date Range" and choose "This Week"

     

    Glad I could help,

     

    Brian

This discussion has been closed.