"starts with" in an expression using DAX

15,948

This expression does the work,

NewColumn =
IF (
    LEFT ( TableName[ColumnToSearchIn], LEN ( "Some string" ) ) = "Some string",
    "Starts With",
    "Does not start with"
)

This expression will determine if ColumnToSearchIn starts with Some string.

Let me know if this helps.

Share:
15,948

Related videos on Youtube

Khalil Liraqui
Author by

Khalil Liraqui

In love with Microsoft technologies like (C#, .NET, Azure, Microsoft BI(SSIS,SSAS), Power Bi ...), passionate about programming, i have developed some few personal projects during my Studies like "Sudoku solver", E-learning. I'm multilingual English, french, Arabic, and some few words in others languages :) , i love discovering new things, new technologies , new places , traveling, hiking, camping. I'm an active couchSurfer, and i can finish Rubix cube :p

Updated on August 04, 2022

Comments

  • Khalil Liraqui
    Khalil Liraqui almost 2 years

    how can write an expression with DAX to check if a String starts by an other string ? example : ext.example starts with "ext."

  • Khalil Liraqui
    Khalil Liraqui almost 8 years
    yes but i want exactly starts with not find anywhere
  • brentlightsey
    brentlightsey over 3 years
    "Some string" could also be stored in variable if the search text is long, or needs to be determined by a formula: NewColumn = VAR search = "Some string" RETURN IF ( LEFT ( TableName[ColumnToSearchIn], LEN ( search ) ) = search, "Starts With", "Does not start with" )