Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I'm looking for a way to have a card visual show a percentage change but have it adjust with a relative date slicer applied to the page. I have seen previous measures for date range slicers but have not been able to find or get a measure that incorporates a relative date slicer. Essentially I want to be able to enter anything like last 7 days or last 90 days in the slicer and have the percentage change for the number of cases from that selected date range compared to the current date update. None of the previous measures I have tried have yielded anything useful, so an example would be greatly appreciated.
Solved! Go to Solution.
Hi @AnF0
Create a numeric range parameter table. Assuming the name of the table created is LastXDays, the name of the automatically crate measure is also the same, create these measures.
Last X Days =
VAR _MaxDate =
CALCULATE ( MAX ( Dates[Date] ), ALLSELECTED ( Dates ) )
VAR _StartDate = _MaxDate - [LastXDays Value] + 1
RETURN
CALCULATE (
[Total Revenue],
KEEPFILTERS ( Dates[Date] >= _StartDate && Dates[Date] <= _MaxDate )
)
Last X Days Prior =
VAR _MaxDate =
CALCULATE ( MAX ( Dates[Date] ), ALLSELECTED ( Dates ) )
VAR _EndDate = _MaxDate - [LastXDays Value] - 1
VAR _StartDate = _EndDate - [LastXDays Value] + 1
RETURN
CALCULATE (
[Total Revenue],
KEEPFILTERS ( Dates[Date] >= _StartDate && Dates[Date] <= _EndDate )
)
Last X Days Variance =
[Last X Days] - [Last X Days Prior]
Last X Days Delta =
DIVIDE ( [Last X Days Variance], [Last X Days Prior] )
Note: In the above example, the _MaxDate is is the max of all the visible Dates[Date] rows. Please see the attached sample pbix.
Hi @AnF0
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
Hi @AnF0
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @AnF0
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @AnF0
Create a numeric range parameter table. Assuming the name of the table created is LastXDays, the name of the automatically crate measure is also the same, create these measures.
Last X Days =
VAR _MaxDate =
CALCULATE ( MAX ( Dates[Date] ), ALLSELECTED ( Dates ) )
VAR _StartDate = _MaxDate - [LastXDays Value] + 1
RETURN
CALCULATE (
[Total Revenue],
KEEPFILTERS ( Dates[Date] >= _StartDate && Dates[Date] <= _MaxDate )
)
Last X Days Prior =
VAR _MaxDate =
CALCULATE ( MAX ( Dates[Date] ), ALLSELECTED ( Dates ) )
VAR _EndDate = _MaxDate - [LastXDays Value] - 1
VAR _StartDate = _EndDate - [LastXDays Value] + 1
RETURN
CALCULATE (
[Total Revenue],
KEEPFILTERS ( Dates[Date] >= _StartDate && Dates[Date] <= _EndDate )
)
Last X Days Variance =
[Last X Days] - [Last X Days Prior]
Last X Days Delta =
DIVIDE ( [Last X Days Variance], [Last X Days Prior] )
Note: In the above example, the _MaxDate is is the max of all the visible Dates[Date] rows. Please see the attached sample pbix.
Hi,
Share some data to work with and show the expected result. Share data in a format that can be pasted in an MS Excel file.
Hi @AnF0 please try this for the previous period measure
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 32 | |
| 27 | |
| 26 |