Forum Discussion

yslee's avatar
yslee
Frequent Visitor
5 years ago
Solved

Dynamically date query

Hi. In my database, I have 2 columns (date and production) filter by a single date slicer. I would like to dynamically plot the 7 days back production data based on the single date slicer value. ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi yslee ,

    You can create a calendar table as a slicer to filter the data in Data table.

    Calendar Date = CALENDAR(DATE(2021,04,01),DATE(2021,04,30))

     

    Then create a measure to return the 7 days back production data.

    last 7 days products = CALCULATE(SELECTEDVALUE('Table'[Product]),FILTER('Table','Table'[Date]>MAX('Calendar Date'[Date])-7 && 'Table'[Date]<=MAX('Calendar Date'[Date])))

     

    The effect is as shown:

    Best Regards

    Community Support Team _ Ailsa Tao

     

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