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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Compare master column to two other columns

I haven't quite found my exact issue in an existing forum post; if there's something already out there on this topic I'd be happy to take a look.

 

I have a table that contains a list of Contact IDs - each numerical ID corresponds to a person. I have two other tables with active relationships to this table - one is a table that has a list of Contact IDs for competitors, and one that is a table that has a list of Contact IDs for alumni.

 

kennedy311_0-1643054184081.png

 

In my All Contacts table, I have created two calculated columns (CompetitorSwitch and AlumniSwitch) to identify the status of each contact for these two categories:

kennedy311_1-1643054281501.png

What I'm trying to do here is create a new column (or measure if that makes more sense) that tells me when a contact is BOTH a competitor and an alumni. I've tried IF statements, SWITCH/TRUE() statements, calculated tables...it's all failed me. I'm not sure if it's a mistake at this stage, or if I messed up by creating the two SWITCH columns first. You'll notice in the data model screenshot that the Alumni and Competitor tables do not have an active relationship, ruling out RELATED and similar functions.

 

I'm completely stuck...open to ideas, and can add more info on the data model if needed. Thanks in advance!

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@ValtteriN  It turns out I was getting too cute with my DAX code. Solved my problem with this:

 

kennedy311_0-1643144912892.png

 

Now it's working as it should:

 

kennedy311_1-1643144950679.png

 

Thank you for the time and insight!

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@ValtteriNI tried your method and here is what it gave me:

kennedy311_0-1643060940176.png

That's the code...here is the full error message:

kennedy311_1-1643060961874.png

Here is what my calculated columns look like (both CompetitorSwitch and AlumniSwitch are set up the same):

kennedy311_2-1643061003291.png

 

Hi,

This error can usually be resolved by using MAX() arounf your columns. E.g.

True Temperature = IF(AND(max(Temperature[Temperature])="Cold",max(Temperature[Temp2])="Cold"),"Very Cold",Temperature[Temp2])
ValtteriN_0-1643092757685.png

 







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

@ValtteriN  Unfortunately this only gives me the ELSE result:

 

kennedy311_0-1643144439080.png

 

Here is my calculated column now:

 

kennedy311_1-1643144496797.png

 

Anonymous
Not applicable

@ValtteriN  It turns out I was getting too cute with my DAX code. Solved my problem with this:

 

kennedy311_0-1643144912892.png

 

Now it's working as it should:

 

kennedy311_1-1643144950679.png

 

Thank you for the time and insight!

ValtteriN
Community Champion
Community Champion

Hi,

Might I inquire how your IF and SWITCH tries failed? The basic formula for two IF conditions is as follows:

True Temperature = IF(AND(Temperature[Temperature]="Cold",Temperature[Temp2]="Cold"),"Very Cold",Temperature[Temp2])


Example data:
ValtteriN_0-1643056280116.png

If this pattern doesn't work ping me with @


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!


 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.