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

Calculated column with multiple text criteria

Hello All, 

 

I am trying to create a new calculated column base on multiple text criteria conditions. 

 

The critieria is if Product Type is not A or B and starts with Description: "xyz", "qss,si", "prc", "aj,prc" assign the numeric value 1 otherwise assign 0.   

 

The result should be: 

Product Type

Description

New calculated Column

A

HDMI

0

B

sirte

0

C

PD

0

D

HD

0

E

qss,si

1

F

aj,prc

1

G

xyz

1


How would this be written? Thanks. 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@langkio,

There you go: 

New Calculated Column = 
IF (
    NOT ( Table[Product Type] IN { "A", "B" } )
        && (
            LEFT ( Table[Description], 3 ) = "xyz"
                || LEFT ( Table[Description], 6 ) = "qss,si"
                || LEFT ( Table[Description], 3 ) = "prc"
                || LEFT ( Table[Description], 6 ) = "aj,prc"
        ),
    1,
    0
)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@langkio,

There you go: 

New Calculated Column = 
IF (
    NOT ( Table[Product Type] IN { "A", "B" } )
        && (
            LEFT ( Table[Description], 3 ) = "xyz"
                || LEFT ( Table[Description], 6 ) = "qss,si"
                || LEFT ( Table[Description], 3 ) = "prc"
                || LEFT ( Table[Description], 6 ) = "aj,prc"
        ),
    1,
    0
)

Thanks!!

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.