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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
SevsBo
Resolver I
Resolver I

Conditional Column not returning expected results

I have a column with data where I need to filter out lines with specific phrases and have found that the Conditional Column is not returning the results I would expect.

 

The column it's drawing from is in Text format, and contains information such as:

123test.Phrase.OtherText

 

Now that Phrase part could also appear in other parts of the text, but here it is nested by two dots, so I tried using a conditional column with this criteria:

 

If Column contains .Phrase. result is X. Only it's not picking it up. 

 

If I manually filter on the query level to check, I can filter out the lines with .Phrase. but the Conditional Column tool doesn't recognize it and just returns null.

 

Any ideas?

 

PS: I'm not trying to filter out this data by itself, so filtering it out on query level wouldn't be a solution. I need to mark it as separate.

1 ACCEPTED SOLUTION
DOLEARY85
Super User
Super User

Hi,

 

can you use power query and do this in a custom column prior to a calculated column?

 

if so try: 

 

if Text.Contains([Text Field],".Phrase.") then "X" else "Y"

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

5 REPLIES 5
DOLEARY85
Super User
Super User

Additionally if you need to use DAX you could create a calculated column with the below:

 

Column = if(CONTAINSSTRING('Table Name'[Text Field],".Phrase."),"X","Y")
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
DOLEARY85
Super User
Super User

Hi,

 

can you use power query and do this in a custom column prior to a calculated column?

 

if so try: 

 

if Text.Contains([Text Field],".Phrase.") then "X" else "Y"

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Gives a Y answer for the lines that should be flagged X, unfortunately.

That's odd, seemes to be working for my tests:

 

DOLEARY85_0-1685460807754.png

do you have some other example data that it's not working on?

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
 

Update: I just tried with case sensitive options, and it worked!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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