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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.