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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
daviss62
Frequent Visitor

Switch True conditions for values in the same column but different rows

Hello.

 

I am trying to use Switch True that would return a specific value is a particular customer has a certain combination of values (from the same column). However, a customer can have more than one row of data--meaning one value being on one row, and the other value on another row. I want to be able to determine whether or not each customer has the specified Code values from that column (though each Code value is on a different row for the same customer), and then return the appropriate resulting "Code Combination" value.

 

When I try the above approach with my actual data table, the new "Code Combination" column returns blanks. Any assistance is greatly appreciated.

 

For example:

Customer ID     Code        

01737298         WBSA

01737298         WMSA

01568489         WBSM

 

Code Combination =

SWITCH(
     TRUE(),

     'Table'[Code] = "WBSA" && 'Table[Code] = "WMSA", "BS to MS")

3 REPLIES 3
v-diye-msft
Community Support
Community Support

Hi @daviss62 

 

Not sure if you'd like to get below result:

Measure 2 = var a = CALCULATE(MAX('Table (3)'[Customer ID]),FILTER('Table (3)',[Code]="WBSA"))
var b = CALCULATE(MAX('Table (3)'[Customer ID]),FILTER('Table (3)',[Code]="WMSA")) 
Return
IF(a=b,BLANK(),"BS to MS")

16.PNG

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Hi @v-diye-msft ,

 

That is close to what I want. However, when I plug in my columns/fields into a new calculated column, I get the following "circular dependency" error message.

 

2019-09-17_15h09_42.png

Hi @daviss62 

 

 I am aware of a circular dependency "issue" when you write multiple calc columns, and their incrementally refer to all columns in a table. Did you use calculated com which should be measure instead?

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors