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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I want to create a calculated column named Category from two tables
DWSP
DInOutdoor
DWSP table has column named WSP
DInOutdoor has column named InOutdoor
Following is the condition I need to implement.
If WSP = ‘STG’ then ‘Strategic’
Else if InOutdoor = ‘Indoor’ then ‘Indoor’
Else if InOutdoor = ‘Oudoor’ then ‘Oudoor’
Else ‘Unknown’
I know how to use switch with single table.Can someone help me how to write above condition when using tables.
Thanks..
Solved! Go to Solution.
Hi @kan
You need to use SWITCH().
New col =
VAR vInOut = RELATED(DInOutdoor[InOutdoor])
RETURN
SWITCH ( TRUE(),
Dwsp[Wsp]= "STG".Strategic,
vInOut = "Indoor","Indoor",
vInout= "Outdoor","Outdoor",
"Unknown")
Thanks
Raj
Hi @kan,
In which table you need to create such a calculated column? Is there any relationship between these two tables? Please provide dummy data to illustrate your scenario.
Regards,
Yuliana Gu
Hi @kan
You need to use SWITCH().
New col =
VAR vInOut = RELATED(DInOutdoor[InOutdoor])
RETURN
SWITCH ( TRUE(),
Dwsp[Wsp]= "STG".Strategic,
vInOut = "Indoor","Indoor",
vInout= "Outdoor","Outdoor",
"Unknown")
Thanks
Raj
What if the DInOutdoor table is on the Many side? How to use RelatedTable then?
Thanks Raj for the solution.
Thanks @AnonymousRaj for the solution.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |