The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
This question seemed to have been asked many times and the answer was not what I as looking for.
In order to help others I am posting this as a show and tell.
The problem statement is that I have a date slicer created from a date table and I want to filter another date slicer to dates between this selected range only.
Slicer ->
Date Table ->
Now I want to limit another date range from above date slicer i.e. in this example between 13/11/2023 and 26/10/2023
Here is 'my' solution (sure there are better ones out there and happpy to learn) based on ideas from other similar solution:
1. Create a duplicate of Dates table called 'Compare Dates'
2. Write following measures
MaxSelectDate = MAX(Dates[Date])
MinSelectDate = MIN(Dates[Date])
CompareDateFilter = if( MAX('Compare Dates'[Compare Date]) < [MaxSelectDate] && MIN('Compare Dates'[Compare Date]) >= [MinSelectDate] ,1)
MaxSelectDate and MinSelectDate are based on 'Dates' table while CompareDateFilter is based on 'Compare Dates' table
Add this measure into Filter
and voila you see 'compare date' is filtered 😊.
How do I use it?
I create a following measures for example:
MV Select Date =
VAR _rptDt = Max(Dates[Date]))
RETURN CALCULATE(SUM(MarketValue[Market Value]),MarketValue[RefDtAsDate] = _rptDt)
MV Compare Date =
VAR _rptDt = SELECTEDVALUE('Compare Dates'[Compare Date])
RETURN CALCULATE(SUM(MarketValue[Market Value]),MarketValue[RefDtAsDate] = _rptDt)
and add it into matrix
and compare between any two dates of my choice
Note: The first slicer with date range I use for showing trend using line chart between the selected dates and the second 'Compare Date' slicer I can compare numbers with any of the selected date in between.
Hope it helps.
Happy to learn how other ways people have implemented this
@lbendlin , yes user wanted two date slicers to compare data between dates of their choice
What's the actual problem you are trying to solve? Is that something your users complained about?