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
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

Anonymous
Not applicable

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))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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.