Forum Discussion

amir_mm's avatar
amir_mm
Icon for Helper III rankHelper III
2 years ago
Solved

Between date slicer - default start and end time

Hi,

I’m using a between date slicer and have applied the measure "CurrentDay = 'Dim-Date'[Date] - TODAY()" with a page-level filter set to "less than or equal to 0" so that the default end date is always the current day. However, I want the default start date to be the current day minus 7 days. This way, when a user opens the report, it will only show data from the last 7 days by default, even though the full date range in the slicer still covers all available data.

I’m not sure how to configure this. Any ideas would be greatly appreciated.

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi amir_mm ,

     

    You can try below formula to create calculated column and use it to page filter.

    CurrentDay = 
    VAR StartDate = TODAY() - 7
    RETURN
        IF('Dim-Date'[Date] >= StartDate && 'Dim-Date'[Date] <= TODAY(), 1, 0)

    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

8 Replies

  • You can use visual level filter on the slicer / page so that your users can only select the last 7 days in the slicer.

     

    • amir_mm's avatar
      amir_mm
      Icon for Helper III rankHelper III

      Thanks, but I want users to have full access to the date range in the slicer, with the default view showing the last 7 days. This way, when the report opens, it will display data from the last 7 days by default, but users can still adjust the toggle to select any dates.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi amir_mm ,

     

    You can try below formula to create calculated column and use it to page filter.

    CurrentDay = 
    VAR StartDate = TODAY() - 7
    RETURN
        IF('Dim-Date'[Date] >= StartDate && 'Dim-Date'[Date] <= TODAY(), 1, 0)

    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • amir_mm's avatar
      amir_mm
      Icon for Helper III rankHelper III

      Thanks for the query. But as I mentioned in the other post and shown in the photo, I still want users to be able to move the slider all the way back to earlier years. So, when a user opens a report, the default view should be the last 7 days, but they should still have the ability to move the toggle back and forth.

      • kushanNa's avatar
        kushanNa
        Icon for Super User rankSuper User

        looks like someone had mistakenly marked the wrong answer as the correct answer, maybe you might need to create a new post 😕 

  • Good Question, I'm having the same issue , so commenting to get this post to the top 

  • Hi amir_mm  I am currently facing the same scenario. If you have already found a solution, could you kindly share it with me so I can resolve this issue as well?

  • Hi amir_mm  I am currently facing the same scenario. If you have already found a solution, could you kindly share it with me so I can resolve this issue as well?