How to display results up to last week

Keisuke_n01
Keisuke_n01 Member
edited March 2023 in Scheduled Reports

At CHART TYPE "Single Value",

I would like to display the results up to last week.

Please tell me how to do this.

Best Answers

  • MarkSnodgrass
    Answer ✓

    You can create a beast mode that will look at the current date and then move it back to the last day of the previous week and then compare it against your date field.

    CASE WHEN `date` <=
    /* last day of the previous week */
         DATE_ADD(DATE_SUB(CURRENT_DATE(), INTERVAL 1 WEEK)
         , INTERVAL (7- DAYOFWEEK(CURRENT_DATE())) DAY) 
    THEN 'Include'
    ELSE 'Exclude' END
    

    You would then drag this beast mode into your filters section and select Include.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • MarkSnodgrass
    Answer ✓

    @Keisuke_n01 that's great to hear. If you can mark accept any answers that helped you, that will help others in the community.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • MarkSnodgrass
    Answer ✓

    No, you should select Flag. Under my replies, you should see something like this:

    Click on Yes to accept it as an answer.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.

Answers

  • MarkSnodgrass
    Answer ✓

    You can create a beast mode that will look at the current date and then move it back to the last day of the previous week and then compare it against your date field.

    CASE WHEN `date` <=
    /* last day of the previous week */
         DATE_ADD(DATE_SUB(CURRENT_DATE(), INTERVAL 1 WEEK)
         , INTERVAL (7- DAYOFWEEK(CURRENT_DATE())) DAY) 
    THEN 'Include'
    ELSE 'Exclude' END
    

    You would then drag this beast mode into your filters section and select Include.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • The script you gave me helped me accomplish what I wanted to do!

    Thank you! It will be a great learning experience.

  • MarkSnodgrass
    Answer ✓

    @Keisuke_n01 that's great to hear. If you can mark accept any answers that helped you, that will help others in the community.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • @MarkSnodgrass  How do I mark this topic? Should I select "Flag"?

  • MarkSnodgrass
    Answer ✓

    No, you should select Flag. Under my replies, you should see something like this:

    Click on Yes to accept it as an answer.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • @MarkSnodgrass Understood, thank you for sharing!