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

Relative date filtering

Hi!

 

I need help! How can I create a relative date filter (13 calender months) based on a different date than today's date (rather, based on a slicer filtered date by the user)?

 

My situation:

I have a dashboard that the user can filter on date with slicers. If for example the user clicks on March and 2018 she will see only march data... I would like to have a graph in the same dashboard, showing the development over time, month by month, from 13 calander month prior to march 2018 which was filtered by the user, up to march 2018.

 

Any ideas? Thanks!

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please check out the demo in the attachment. 

You need an independent slicer table, which means no relationship can be created. Then create a measure.

Measure =
VAR selectedYearMonth =
    SELECTEDVALUE ( SlicerTable[YearMonth] )
RETURN
    CALCULATE (
        SUM ( FactTable[Value] ),
        DATESINPERIOD ( 'FactTable'[Date], MAX ( 'SlicerTable'[Date] ), -14, MONTH )
    )

Relative_date_filtering

Best Regards,

Dale

Community Support Team _ Dale
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
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please check out the demo in the attachment. 

You need an independent slicer table, which means no relationship can be created. Then create a measure.

Measure =
VAR selectedYearMonth =
    SELECTEDVALUE ( SlicerTable[YearMonth] )
RETURN
    CALCULATE (
        SUM ( FactTable[Value] ),
        DATESINPERIOD ( 'FactTable'[Date], MAX ( 'SlicerTable'[Date] ), -14, MONTH )
    )

Relative_date_filtering

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi! This worked! Thanks so much for taking the time to help me!

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.