Forum Discussion
Help with a problematic measure
- 1 year ago
AC23VM Measure to count occurrences in the last 3 months excluding the current month:
DAX
CDSubRootCauseLast3MonthsCount =
CALCULATE(
COUNT('Sheet1'[Consumer Duty Sub Root Cause]),
DATESINPERIOD(
'Sheet1'[Date Completed],
EOMONTH(TODAY(), -1), -- End of the previous month
-3,
MONTH
)
)Measure to get the top 5 values:
DAX
CDSubRootCauseTop5Values =
VAR ExcludedValues = {"NA", "N_A_", "Not Applicable"}
VAR FilteredTable =
CALCULATETABLE(
VALUES('Sheet1'[Consumer Duty Sub Root Cause]),
NOT 'Sheet1'[Consumer Duty Sub Root Cause] IN ExcludedValues,
DATESINPERIOD(
'Sheet1'[Date Completed],
EOMONTH(TODAY(), -1), -- End of the previous month
-3,
MONTH
)
)
VAR RankValue =
RANKX(
FilteredTable,
[CDSubRootCauseLast3MonthsCount],
,
DESC,
DENSE
)
RETURN
IF(
RankValue <= 5,
[CDSubRootCauseLast3MonthsCount],
BLANK()
)
AC23VM Measure to count occurrences in the last 3 months excluding the current month:
DAX
CDSubRootCauseLast3MonthsCount =
CALCULATE(
COUNT('Sheet1'[Consumer Duty Sub Root Cause]),
DATESINPERIOD(
'Sheet1'[Date Completed],
EOMONTH(TODAY(), -1), -- End of the previous month
-3,
MONTH
)
)
Measure to get the top 5 values:
DAX
CDSubRootCauseTop5Values =
VAR ExcludedValues = {"NA", "N_A_", "Not Applicable"}
VAR FilteredTable =
CALCULATETABLE(
VALUES('Sheet1'[Consumer Duty Sub Root Cause]),
NOT 'Sheet1'[Consumer Duty Sub Root Cause] IN ExcludedValues,
DATESINPERIOD(
'Sheet1'[Date Completed],
EOMONTH(TODAY(), -1), -- End of the previous month
-3,
MONTH
)
)
VAR RankValue =
RANKX(
FilteredTable,
[CDSubRootCauseLast3MonthsCount],
,
DESC,
DENSE
)
RETURN
IF(
RankValue <= 5,
[CDSubRootCauseLast3MonthsCount],
BLANK()
)