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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I need help with multiple table If statement, I tried to give sample tables below.
If Column Code=100 then the new column should be XYZ else if the Column is Grp is 8fni then it should be ABC, the rest are EFG
Table 1:
| Code | Sales | DAX HELP! |
| 100 | 190 | |
| 102 | 93 | |
| 109 | 89 | |
| 200 | 93 | |
| 290 | 9 | |
| 100 | 39 | |
| 100 | 89 | |
| 200 | 99 | |
| 100 | 20 | |
| 290 | 289 | |
| 102 | 98 | |
| 109 | 78 | |
| 200 | 398 | |
| 102 | 92 | |
| 100 | 83 | |
| 109 | 109 |
Table 2:
| key | Grp |
| a | 0so |
| b | 0dk0 |
| c | 0kis |
| d | 8vhi |
| e | 8fni |
| f | 8hf8 |
Solved! Go to Solution.
Hey @powerbihelp87 ,
yes, you can write it like that:
DAX Help Column =
SWITCH(
TRUE(),
'Table 1'[Code] = "100", "XYZ",
RELATED( 'Table 2'[Grp] )
IN {
"8fni",
"8vhi",
"0kis"
}, "ABC",
"EFG"
)
By the way, always link someone in an answer like that: @powerbihelp87
Otherwise I won't get a notification that you answered.
Hey @powerbihelp87 ,
logically it doesn't really make sense.
A calculated column always has to be in a specific table.
You are asking to put "XYZ" when a column from Table 1 has a value and "ABC" when the column of another table is a specific value. How are they connected?
Please explain a little better.
Best regards
Denis
@powerbihelp87 not really clear what you are looking for? How these tables are connected? What is your expected output give the logic you explained. The most critical part is how these tables are connected.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@selimovd @parry2k I was missing the Code column in the example Table 2 to show they are related, I was able to figure out the formula I needed below. It works fine. I am trying to see how to write multiple options if the IF Related portion of the formula.
DAX Help Column =IF(Table 1[Code]="100", "XYZ",IF(RELATED(Table 2[Grp]="8fni","ABC","EFG" ))
Hey @powerbihelp87 ,
sure, next time just give more details.
You can make it more readable with a SWITCH/TRUE:
DAX Help Column =
SWITCH(
TRUE(),
'Table 1'[Code] = "100", "XYZ",
RELATED( 'Table 2'[Grp] ) = "8fni", "ABC",
"EFG"
)
Thanks Denis!
Do you know how I can write the syntax if there are multiple options for this portion:
RELATED( 'Table 2'[Grp] ) = "8fni"
For example if any of these from Grp field: "8fni" or "8vhi" or "0kis" THEN it is ABC
Hey @powerbihelp87 ,
yes, you can write it like that:
DAX Help Column =
SWITCH(
TRUE(),
'Table 1'[Code] = "100", "XYZ",
RELATED( 'Table 2'[Grp] )
IN {
"8fni",
"8vhi",
"0kis"
}, "ABC",
"EFG"
)
By the way, always link someone in an answer like that: @powerbihelp87
Otherwise I won't get a notification that you answered.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!