Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
reynold522
Helper II
Helper II

switch programming

Hi all,
 
Capacitythreshold =
SWITCH (TRUE(),
'table'[REGION] = "US", 'table'[CAPACITY_AH]*200*4,
'table'[REGION] = "EU"&&'table'[BAT_TYPE]="1",'table'[CAPACITY_AH]*200,
'table'[REGION] = "EU"&&'table'[BAT_TYPE]="2", 'table'[CAPACITY_AH]*150,
table'[REGION] = "EU"&&'table'[BAT_TYPE]="3", 'table'[CAPACITY_AH]*100,
BLANK())
 
I implemented above code, if I modify the red colour part to a constant number, e.g., I replace 'table'[CAPACITY_AH]*200*4 with 800 this code will work.
However, I would like to keep is as a calculated value base on table. 
How can I modify the code to make it work?
 
Thanks in advance. 
 
Best regards
2 REPLIES 2
djurecicK2
Super User
Super User

Are you creating a measure or calculated column? For measure, You have to do an aggregation on the field like SUM, etc. 

djurecicK2
Super User
Super User

Hi @reynold522 ,

 I would try creating measures for each of those values in red and using those measures in the SWITCH statement.

 

 

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.