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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.