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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
marienugent
Regular Visitor

Date Sliders OR Logic

Hello. I am new to Power BI. I am needing to add a date slider to my report, however, I need the slider to look at two different columns and use an OR logic.

 

For example, if we had a purchased date column and a returned date column, I would need the slider to look at purchase date in selected range OR returned date in selected range.

 

Is this possible to do?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @marienugent ,

 

You can try this code to get count result.

Count = 
VAR _Date_Range =
    VALUES ( 'Calendar'[Date] )
RETURN
    CALCULATE(COUNT('Table'[ID]),FILTER('Table', OR ( 'Table'[Purchase Date] IN _Date_Range, 'Table'[Returned Date] IN _Date_Range )))

Result is as below.

RicoZhou_0-1669801458337.png

 

Best Regards,
Rico Zhou

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi @marienugent ,

 

I suggest you to create an unrelated calendar table for slicer and then create a measure to filter your visual in visual level filter.

My Sample:

RicoZhou_0-1668583529359.png

Measure:

Measure Filter = 
VAR _Purchase_Date =
    SELECTEDVALUE ( 'Table'[Purchase Date] )
VAR _Returned_Date =
    SELECTEDVALUE ( 'Table'[Returned Date] )
VAR _Date_Range =
    VALUES ( 'Calendar'[Date] )
RETURN
    IF ( OR ( _Purchase_Date IN _Date_Range, _Returned_Date IN _Date_Range ), 1, 0 )

In my sample, my date range is from 2022/10/01 to 2022/10/31, so the visual should return ID 1/3/4. 

RicoZhou_1-1668583653099.png

 

Best Regards,
Rico Zhou

 

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

 

This works, but only if I am displaying the dates in the visual, which I do not want them displayed. The only thing I need in the visual is a count of revenue and transactions, but I need the slicer to be able to accurately change those counts based on the purchase and returned dates.

Anonymous
Not applicable

Hi @marienugent ,

 

You can try this code to get count result.

Count = 
VAR _Date_Range =
    VALUES ( 'Calendar'[Date] )
RETURN
    CALCULATE(COUNT('Table'[ID]),FILTER('Table', OR ( 'Table'[Purchase Date] IN _Date_Range, 'Table'[Returned Date] IN _Date_Range )))

Result is as below.

RicoZhou_0-1669801458337.png

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors