Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Background:
I have to switch between 55 measures and 16 dimensions at the same time in the query. My main query is:
MetricMeasure:=
CALCULATE( <Selected Measure>,
USERELATIONSHIP( Interface[Values], <Selected Dimension> )
)
in the above query, measure and dimension need to change in accordance with the selection on the report shown below.
Problem: This functionality is working fine with few measures and a few dimensions but with 55 measures and 16 dimensions my code is becoming 900 lines for code.
Example Code of MetricMeasure with 2 measure and 2 dimensions looks like this.
MetricMeasure:=
SWITCH (
SELECTEDVALUE ( Master_Dimension[Dimension] ),
"Age Group", CALCULATE (
SWITCH (
SELECTEDVALUE( DIM_metric_center[Metric] ) ,
"Total Overtime Cost", FACT_Payroll[Overtime],
"Total Payroll Cost", FACT_Payroll[Total Payroll Cost],
BLANK ()
),
USERELATIONSHIP ( Interface[Values], Master_Age_Group[Age Group] )
),
"Company", CALCULATE (
SWITCH (
SELECTEDVALUE( DIM_metric_center[Metric] ) ,
"Total Overtime Cost", FACT_Payroll[Overtime],
"Total Payroll Cost", FACT_Payroll[Total Payroll Cost],
BLANK ()
),
USERELATIONSHIP ( Interface[Values], DIM_company[LCC Code] )
)
)
Error Message:
Any suggestion, how can I change the code in a way to use a nested Switch for 55 measure and 16 dimensions combination.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.