Forum Discussion

togsoo1's avatar
togsoo1
Frequent Visitor
3 years ago

Filtering dates in Power BI using a single slicer for 2 dates

Based on this: https://www.youtube.com/watch?v=W5n8-5Q7mII

And : https://radacad.com/power-bi-from-and-to-date-filtering-with-one-slicer

 

Hello everyone, how can I achieve functionality without displaying the dates in the visual? Currently, this setup requires both dates to be present in the visual. However, my goal is to apply this to the entire page, featuring various charts.

 

I got this : 

 

I want this : 

My measure "InDateRange" to filter Dates on the 2 tables : 

 

InDateRange = 
VAR _rangeStart = FIRSTDATE('DatesDim'[Date])
VAR _rangeEnd = LASTDATE('DatesDim'[Date])
VAR _selectedDate1 = SELECTEDVALUE('IW69'[Date 2])
VAR _selectedDate2 = SELECTEDVALUE('IW39Ex'[Date 1])

RETURN
IF(
    _selectedDate1 >= _rangeStart
    && _selectedDate1 <= _rangeEnd
    && _selectedDate2 >= _rangeStart
    && _selectedDate2 <= _rangeEnd
    && _selectedDate1 <> BLANK()
    && _selectedDate2 <> BLANK(),
    1,
    0
)

 

My file : https://drive.google.com/drive/folders/1Z_-FPTkbzgg8pgh5RHJsPrivH-ErsyGE?usp=sharing

 

Thanks

No RepliesBe the first to reply