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
PowerBI123456
Post Partisan
Post Partisan

DAX Starts with

Hi - I want to see if a column starts with a specific line of strings (e.g. "992"). How can I do that in DAX (not power query)?

 

Thanks in advance!

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @PowerBI123456 ,

 

Try the following:

LEFT(Table[Column]), 3) = "992"

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi @PowerBI123456 ,

 

Try the following:

LEFT(Table[Column]), 3) = "992"

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



And what about cases where length of the string I'm looking for vary? For example {"site", "location"}

What do you mean by having a different length?

 

This is for the beginning of the text so it does not matter the size of the text.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



If I want to look for different words (example list in { }) which differ in length if text starts with those and depending on which does it start with, take different action

Then you can use MID() instead of LEFT()

amitchandak
Super User
Super User

@PowerBI123456 , Try a new column like

if(left([col1],3) = "992",1,0)

 

or measure

calculate(countrows(Table),filter(Table,left([col1],3) = "992",1,0))

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.