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
kimrhansen
Frequent Visitor

Measure to return different columns depending on conditions

Hi all,

 

I am trying to do something like this

 

if the following conditon is met

Product is ship, the year is 2016 and the color is blue then the measure should take the value sales from table1

otherwise it should take the vale sales2 from table2.

 

Measure  = IF(and(and(product="Ships";year="2016");color="Blue");Table1[sales];table2[sales2])

 

It is incredible how much trouble this is giving me.

 

3 REPLIES 3
v-qiuyu-msft
Community Support
Community Support

Hi @kimrhansen,

 

Assume the Product, Year and Color comes from the Table1, please try to create a measure like below:

 

Measure = IF(and(and(MAX('Table1'[Product])="Ships",MAX('Table1'[Year])="2016"),MAX('Table1'[Color])="Blue"),SUM(Table1[sales]),SUM(Table3[Sales2]))

 

If it doesn't meet your requirement, please share sample data about those two tables for us to analyze.  

 

Best Regards,
Qiuyun Yu

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

Are these tables related?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
spuder
Resolver IV
Resolver IV

Hi @kimrhansen

 

is "ships", "color" and/or "year" part of one of those tables?

 

And should your result be only one number or will it be used in a visual that has more categories?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.