Forum Discussion
Slicer not affecting measure
- 1 year ago
Hi LostintheBIu ,
The issue arises because the LatestAccount10000PostedDate variable is calculated without considering the date slicer, which results in a fixed upper boundary that ignores the slicer selection. To make the measure dynamic while ensuring it remains responsive to the slicer, you can define the slicer range using MIN and MAX functions while ensuring the end date does not exceed LatestAccount10000PostedDate. The updated measure is:
Account 20000 Actuals = VAR LatestAccount10000PostedDate = CALCULATE( MAX(DateTable[Dates]), 'Actuals'[Account] = 10000 ) VAR SlicerStartDate = MIN(DateTable[Dates]) VAR SlicerEndDate = MAX(DateTable[Dates]) RETURN CALCULATE( [Actuals sum measure], 'Actuals'[Account] = 20000, 'DateTable'[Dates] >= SlicerStartDate, 'DateTable'[Dates] <= MIN(SlicerEndDate, LatestAccount10000PostedDate) )This ensures that the measure dynamically filters actuals for Account 20000 within the slicer’s selected date range while capping the end date at the most recent Account 10000 posting date. If the slicer is set to February 2025, it returns actuals from February 1st to 28th, while a slicer selection for 2024 will return all 2024 actuals. If the slicer is set beyond February 28, 2025, no values will be returned since it exceeds the latest posting date. This approach maintains both the slicer’s influence and the upper boundary condition.
Best regards,
Hi LostintheBIu ,
The issue arises because the LatestAccount10000PostedDate variable is calculated without considering the date slicer, which results in a fixed upper boundary that ignores the slicer selection. To make the measure dynamic while ensuring it remains responsive to the slicer, you can define the slicer range using MIN and MAX functions while ensuring the end date does not exceed LatestAccount10000PostedDate. The updated measure is:
Account 20000 Actuals =
VAR LatestAccount10000PostedDate =
CALCULATE(
MAX(DateTable[Dates]),
'Actuals'[Account] = 10000
)
VAR SlicerStartDate = MIN(DateTable[Dates])
VAR SlicerEndDate = MAX(DateTable[Dates])
RETURN
CALCULATE(
[Actuals sum measure],
'Actuals'[Account] = 20000,
'DateTable'[Dates] >= SlicerStartDate,
'DateTable'[Dates] <= MIN(SlicerEndDate, LatestAccount10000PostedDate)
)
This ensures that the measure dynamically filters actuals for Account 20000 within the slicer’s selected date range while capping the end date at the most recent Account 10000 posting date. If the slicer is set to February 2025, it returns actuals from February 1st to 28th, while a slicer selection for 2024 will return all 2024 actuals. If the slicer is set beyond February 28, 2025, no values will be returned since it exceeds the latest posting date. This approach maintains both the slicer’s influence and the upper boundary condition.
Best regards,
Worked perfectly, thank you! 🙂