Forum Discussion
DAX Help
- 1 year ago
Hi redomer44 - CALCULATE with FILTER and COUNTROWS in the way you did won’t work as expected because CALCULATE does not interact well with MAX in the FILTER context like this. Instead, you should use a pattern that applies the logic directly in the measure without the FILTER function.
check the below measure for better than baseline AND target
BetterThanBaselineAndTargetCount =
CALCULATE(
COUNTROWS('_FY25 CFG Performance OG'),
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] >= '_FY25 CFG Performance OG'[Baseline],
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] >= '_FY25 CFG Performance OG'[FY 24Target]
)another measure for better than baseline BUT NOT target
BetterThanBaselineNotTargetCount =
CALCULATE(
COUNTROWS('_FY25 CFG Performance OG'),
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] >= '_FY25 CFG Performance OG'[Baseline],
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] < '_FY25 CFG Performance OG'[FY 24Target]
)worse than baseline and target create another measure:
WorseThanBaselineAndTargetCount =
CALCULATE(
COUNTROWS('_FY25 CFG Performance OG'),
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] < '_FY25 CFG Performance OG'[Baseline],
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] < '_FY25 CFG Performance OG'[FY 24Target]
)check the above logics.
Hi redomer44 - CALCULATE with FILTER and COUNTROWS in the way you did won’t work as expected because CALCULATE does not interact well with MAX in the FILTER context like this. Instead, you should use a pattern that applies the logic directly in the measure without the FILTER function.
check the below measure for better than baseline AND target
BetterThanBaselineAndTargetCount =
CALCULATE(
COUNTROWS('_FY25 CFG Performance OG'),
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] >= '_FY25 CFG Performance OG'[Baseline],
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] >= '_FY25 CFG Performance OG'[FY 24Target]
)
another measure for better than baseline BUT NOT target
BetterThanBaselineNotTargetCount =
CALCULATE(
COUNTROWS('_FY25 CFG Performance OG'),
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] >= '_FY25 CFG Performance OG'[Baseline],
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] < '_FY25 CFG Performance OG'[FY 24Target]
)
worse than baseline and target create another measure:
WorseThanBaselineAndTargetCount =
CALCULATE(
COUNTROWS('_FY25 CFG Performance OG'),
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] < '_FY25 CFG Performance OG'[Baseline],
'_FY25 CFG Performance OG'[as of 9/30/23 - Copy] < '_FY25 CFG Performance OG'[FY 24Target]
)
check the above logics.