Forum Discussion
DAX Filter Data based on Certain Date Range
- Anonymous3 years ago
Hi Anonymous ,
I suggest you to set the two relationships between Calendar table and QCDailyTarget table to inactive.
Or your visual will be impacted by the relationship.
I suggest you to create a measure to filter your visual.
FilterMeasure = VAR _RANGESTART = MIN ( 'Calendar'[Date] ) VAR _RANGEEND = MAX ( 'Calendar'[Date] ) RETURN IF ( SELECTEDVALUE ( QCDailyTarget[Start Date] ) <= _RANGESTART && SELECTEDVALUE ( QCDailyTarget[End Date] ) >= _RANGEEND, 1, 0 )Add this measure into visual level filter and set it to show items when value = 1.
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 tamerj1 ,
So referring to my initial question , the expected output are Jr QC with the value of 3 and with other types after using the month and year slicer December 2022. The result i am getting right now is getting all 3 rows of Jr QC and other types ( which intended only 1 Jr QC).
Hi Anonymous ,
I suggest you to set the two relationships between Calendar table and QCDailyTarget table to inactive.
Or your visual will be impacted by the relationship.
I suggest you to create a measure to filter your visual.
FilterMeasure =
VAR _RANGESTART =
MIN ( 'Calendar'[Date] )
VAR _RANGEEND =
MAX ( 'Calendar'[Date] )
RETURN
IF (
SELECTEDVALUE ( QCDailyTarget[Start Date] ) <= _RANGESTART
&& SELECTEDVALUE ( QCDailyTarget[End Date] ) >= _RANGEEND,
1,
0
)
Add this measure into visual level filter and set it to show items when value = 1.
Result is as below.
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.