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

DAX Nested IF Statement to search existing column for Certain String Value

Good day,

 

Quite new to Power BI & DAX. Been struggling to get something, which is simple to achieve in Excel (for example) to work.

 

Essentially, I have a column of data, which for this reference is called [existing], then I would like to make use of a new column and DAX formula to control the output. The new column name would be "NewName" for this example.

 

The NewName should search in the existing column for a certain string, if that search is satisfied, it should provide me with a value. Refer to the sample below which might explain this a bit better.

 

DAX_Sample.png

 

If I make use of a single IF statement, I get to my result:

NewName = IF(ISERROR(SEARCH("Zone 00", T1[existing])),"0", "L00")

 

But, I require a Nested IF Statement to achieve what I'm after and everything which I've tried i.e. AND / OR  & CONTAIN functions which didn't leave me with any luck.

 

Is there a better way to approach this or are there other functions which I can use which will assist? I will require a DAX solution due to the workflow which I'm setting up.

 

Thank you in advance!

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

Try this calculated column formula

 

="L"&MID([Existing],6,2)

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

Try this calculated column formula

 

="L"&MID([Existing],6,2)

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks @Ashish_Mathur, sometimes the simplest of answers stair us right in the face. Didn't even think of making use of the MID function while trying to overcomplicate my DAX formula...

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.