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

Convert Spotfire Condition

Please, How I can convert following Spotfire condition in Power Bi?

 

case  when ([POSOWNER]="PACKAGING") or ([POSOWNER]="WAREHOUSE") then "P&WH"
 when [POSOWNER]="ASEPTIC" then "ASEPTIC"
 when [POSOWNER]="QC" then "QC"
 when [POSOWNER]="BACTERIAL PRIMARY" then "BACTERIAL PRIMARY"
 when [POSOWNER]="BACTERIAL GLYCO" then "BACTERIAL PRIMARY"
 when [POSOWNER]="BACTERIAL OMV" then "BACTERIAL PRIMARY"
 when [POSOWNER]="PRODUCT RELEASE" then "PRODUCT RELEASE"
else "OTHER" end

 

Thank you

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @LD 

try SWITCH()

Column = SWITCH([POSOWNER],
"PACKAGING", "P&WH",
"WAREHOUSE", "P&WH",
"ASEPTIC","ASEPTIC",
"QC","QC",
BACTERIAL PRIMARY","BACTERIAL PRIMARY",
"BACTERIAL GLYCO", "BACTERIAL PRIMARY",
"BACTERIAL OMV" , "BACTERIAL PRIMARY",
"PRODUCT RELEASE", "PRODUCT RELEASE",
"OTHER"
)

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
az38
Community Champion
Community Champion

Hi @LD 

try SWITCH()

Column = SWITCH([POSOWNER],
"PACKAGING", "P&WH",
"WAREHOUSE", "P&WH",
"ASEPTIC","ASEPTIC",
"QC","QC",
BACTERIAL PRIMARY","BACTERIAL PRIMARY",
"BACTERIAL GLYCO", "BACTERIAL PRIMARY",
"BACTERIAL OMV" , "BACTERIAL PRIMARY",
"PRODUCT RELEASE", "PRODUCT RELEASE",
"OTHER"
)

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

You can do it in two ways

1 which is above suggested using switch and another one is nested if statements.

But as per coding point of view switch functions are better for such requirements.

Thanks
Pravin

If it resolves your problem Mark it as a solution and give Kudos.

Helpful resources

Announcements
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!

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.