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
Anonymous
Not applicable

Trying to create a TRUE/FALSE Column with multiple conditions across different fields

Hello,

I'm trying to create a TRUE/FALSE column with conditions from 2 different columns. The "search" DAX function seems to work partially, but is not being as specific as I would like. 

The logic for the formula is as follows:

IF [meddislvl] contains "??O*" and [Total Time On Phone (s)Secs] is > 300, then TRUE, else FALSE

The formula I used is:

 

Omega Overage =IF(

AND(

SEARCH ( "??O*", [meddislvl], 1, 0) > 0,

[Total Time On Phone (s)Secs] > 300

),

"TRUE", "FALSE")



However this only appears to work partially, as it ignores the 2 character limit and wildcard, and returns TRUE for any and all [meddislvl] that contains an "O" in it, regardless if it has 2 characters in front, or multiple characters after. An example of what I would specifically want is it to return TRUE for [meddislvls] that contain something like "77O01M", but instead it also returns TRUE for [meddislvls] like "06E01O" which I do not want (as the main identifier for an OMEGA, is the "O" being in the center of the [meddislvls] rather than the end, and the "E" represents an "ECHO" in this example). 

I appreciate your time and assistance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

It seems that the SEARCH function didn't like the wildcard being in the formula, so I just used "?", added multiple searches within the formula and added an OR operator " || ", and that seems to have done the trick. Formula below:

Omega Overage = 

IF((

SEARCH ( "??O??", [meddislvl], 1, 0) ||

SEARCH ("??O???", [meddislvl], 1, 0)) && [Total Time On Phone (s)Secs] > 300,

"TRUE",

"FALSE"

)

View solution in original post

1 REPLY 1
Anonymous
Not applicable

It seems that the SEARCH function didn't like the wildcard being in the formula, so I just used "?", added multiple searches within the formula and added an OR operator " || ", and that seems to have done the trick. Formula below:

Omega Overage = 

IF((

SEARCH ( "??O??", [meddislvl], 1, 0) ||

SEARCH ("??O???", [meddislvl], 1, 0)) && [Total Time On Phone (s)Secs] > 300,

"TRUE",

"FALSE"

)

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.