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
Antonio195754
Helper IV
Helper IV

How to flag multiple items in a column using a calculated column

Hi i have a column that has several data points, 25 different "reasons", in the column.  I'm trying to flag only 5 of those "reasons" but not sure how to do that.  I can do it with an IF statement/&&, but that's only going to return if they all meet the condition, i'm looking for an OR statement probably to make this work

 

Case Reason Flag = IF ( ('Table'[Column]) = "X" && 'Table'[Column] ="Y" && 'Table'[Column]= "Z" && 'Table'[Column] = "A" && 'Table'[Column] = "B", "1" , "0")
2 ACCEPTED SOLUTIONS
bcdobbs
Super User
Super User

You could do it with the same IF but use || for or.

 

Alternatively try SWITCH...


SWITCH(
          TRUE(),
          Table[Col1]<1,1,
          Table[Col2] = 5, 1,
          0)



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

AlexisOlson
Super User
Super User

You could change all your && to || but I'd suggest the following instead:

IF (
    'Table'[Column] IN { "X", "Y", "Z", "A", "B" },
    "1",
    "0"
)

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

You could change all your && to || but I'd suggest the following instead:

IF (
    'Table'[Column] IN { "X", "Y", "Z", "A", "B" },
    "1",
    "0"
)
bcdobbs
Super User
Super User

You could do it with the same IF but use || for or.

 

Alternatively try SWITCH...


SWITCH(
          TRUE(),
          Table[Col1]<1,1,
          Table[Col2] = 5, 1,
          0)



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your 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.

Top Solution Authors