Forum Discussion
Date Sliders OR Logic
- Anonymous3 years ago
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.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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:
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.
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.
- Anonymous3 years agoNot 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.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.