Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

How to validate an entry by an specified field format

Hello PBI Community, 

 

I have a request in my report that I am not sure how to get sorted. Let me try to explain here. I have a column with a Tag number, and the format for this entry must be: three numbers, dash, two letters, dash, four numbers 

I'd like to have a measure to validate this Tag number format with a Yes or No. If the Tag meets the standard format (three numbers, dash, two letters, dash, four numbers ),  then it will be a yes; otherwise, it will be a no. 

 

 

does anybody has any idea how to get that? 

 

Thank you,

Julio

 

  • Anonymous , Create a new column in power query like this

     

    let _a = Text.Split([Tag],"-")
    in
    if Text.Length (_a{0}) =3 and Text.Length (_a{1}) =2 and Text.Length (_a{2}) =3 then 1 else 0

2 Replies

  • Anonymous , Create a new column in power query like this

     

    let _a = Text.Split([Tag],"-")
    in
    if Text.Length (_a{0}) =3 and Text.Length (_a{1}) =2 and Text.Length (_a{2}) =3 then 1 else 0

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Amit, all good with the syntax... I entered it as a custom column. One more question, how would the query be if this field "Text.Length (_a{1}) =2" would accept as text length either 2 or 3?

       

      thank you