Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi
I was wondering if there might be a way to simplify my measure such that I don’t need to specify every slicer filter that needs to be unselected/off for the hard-coded ‘Year count’ scenarios to occur.
Sum of SUMX CN-Q code targeted count with hard-coded Year totals final v2 =
SWITCH( TRUE(),
([SelectedYear OrderAsc] = "21/22") && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[FT or PT]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Level]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Campus]) = False), "4892",
([SelectedYear OrderAsc] = "22/23") && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[FT or PT]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Level]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Campus]) = False), "4511",
([SelectedYear OrderAsc] = "23/24") && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[FT or PT]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Level]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Campus]) = False), "4853",
([SelectedYear OrderAsc] = "21/22, 22/23") && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[FT or PT]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Level]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Campus]) = False), "9403",
([SelectedYear OrderAsc] = "21/22, 23/24") && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[FT or PT]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Level]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Campus]) = False), "9745",
([SelectedYear OrderAsc] = "22/23, 23/24") && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[FT or PT]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Level]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Campus]) = False), "9364",
([SelectedYear OrderAsc] = "21/22, 22/23, 23/24") && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[FT or PT]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Level]) = False) && (ISFILTERED(Main_Inc_CC_And_tfs_SurveyResults[Campus]) = False), "14256",
[Sum of SUMX CN-Q code targeted count]
)
SelectedYear OrderAsc =
CONCATENATEX(
VALUES(Main_Inc_CC_And_tfs_SurveyResults[ShortYear]),
Main_Inc_CC_And_tfs_SurveyResults[ShortYear],
", ",
Main_Inc_CC_And_tfs_SurveyResults[ShortYear],
ASC
)
Also so that I don’t need to update the measure scenarios everytime I add new slicers to my report page.
I hope that's makes sense. Please let me know if you have any questions.
The source data and powerBI files are available via the following links:
ReturnsData_21_22_to_23_24_Test_v1.xlsx
Any help would be really appreciated.
Best Wishes
JFarq
Also for your reference:
Sum of SUMX CN-Q code targeted count =
CALCULATE (
[SUMX CN-Q code targeted count],
ALLSELECTED(Main_Inc_CC_And_tfs_SurveyResults[CN-Q code])
)
SUMX CN-Q code targeted count = SUMX( ReturnsData_21_22_to_23_24, [CN-Q code targeted count])
CN-Q code targeted count =
CALCULATE (
SUM ( ReturnsData_21_22_to_23_24[Targeted] ),
FILTER (
ReturnsData_21_22_to_23_24,
ReturnsData_21_22_to_23_24[CN-Q code] == MAX ( Main_Inc_CC_And_tfs_SurveyResults[CN-Q code] )
)
)
Sum of SUMX CN-Q code targeted count with hard-coded Year totals final v2 =
IF(ISFILTERED ( Main_Inc_CC_And_tfs_SurveyResults[FT or PT] )
|| ISFILTERED ( Main_Inc_CC_And_tfs_SurveyResults[Level] )
|| ISFILTERED ( Main_Inc_CC_And_tfs_SurveyResults[Campus] ),[Sum of SUMX CN-Q code targeted count],
VAR y = VALUES(Main_Inc_CC_And_tfs_SurveyResults[ShortYear])
RETURN ("21/22" IN y) * 4892 +("22/23" IN y) * 4511 + ("23/24" IN y) * 4853
)