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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Create filter using DIM_Date Table

Hi Experts

 

No sure if this is pretty striaght forward or more complex then i am making it out to be. I have a Dim-Date Table where the first column is the date column which cover a period (todays back to the last 5yrs).

 

I want to be able to create a slicer based on the date column where i can filter my data based on the last 7 Days, 30 Days and 60 days, using a slicer.

 

note the last 30 days must incl the last 7 days values too....

 

Canadapvalue.PNG

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

As I know, you could use slicer->relative date , which you could choose last N day without creating "Result column". In addition, you also could create last 7, last 30 's measure and use it when you choose this in slicer, you could refer to my sample for details.

Best Regards,
Zoe Zhi

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

4 REPLIES 4
amitchandak
Super User
Super User

Refer, how to create a slicer to choose a measure

https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...

 

Formula example

Rolling 7 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-7,Day))  
Rolling 14 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-14,Day))
Rolling 30 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-30,Day))
Rolling 60 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-60,Day))

 

Appreciate your Kudos.

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
Anonymous
Not applicable

HI Amit

 

thanks for the feedback but i am getting the following error message

Error Message:

MdxScript(Model) (63, 73) Calculation error in measure '_Measures'[Rolling 7]: An invalid numeric representation of a date value was encountered.

dax
Community Support
Community Support

Hi @Anonymous , 

As I know, you could use slicer->relative date , which you could choose last N day without creating "Result column". In addition, you also could create last 7, last 30 's measure and use it when you choose this in slicer, you could refer to my sample for details.

Best Regards,
Zoe Zhi

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

Anonymous
Not applicable

Simply use relative date slicer and filter out data as you want.

 

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.