Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
yslee
Frequent Visitor

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. How can I do this?

For example
Slicer date selected: 7th apr 2021
Production data retrieve
1st apr
2nd apr
3rd apr
4th apr
5th apr
6th apr
7th apr
1 ACCEPTED SOLUTION
Anonymous
Not applicable

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:

Ailsa-msft_0-1618362221440.png

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.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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:

Ailsa-msft_0-1618362221440.png

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.

amitchandak
Super User
Super User

@yslee , if you select a date and plot more than that date , you need an independent date table https://www.youtube.com/watch?v=44fGGmg9fHI

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors