Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Format Check

Hello,

 

I have seen a similar post, but it did not quite help for my circumstance. I would like to see if a value is appropriately formatted. For example if a claim number is supposed to be 9 digits long have a dash then be followed by 4 digits.

 

Examples:

857639237-8473

382838388-3928

383832838-3939

 

If the claim number is in the correct format as listed above I would like it to return a "Y", if not then a "X".

 

Any help would be greatly appreciated.

 

Thanks

1 ACCEPTED SOLUTION
DataVitalizer
Super User
Super User

Hi @Anonymous 

I created for you this code which you can paste in a new calculated column to check whether the value is in the correct format

Check = 
VAR _1=IF(ISERROR(CONVERT(LEFT('Table'[Examples],9),INTEGER)),"FALSE","TRUE")
VAR _2=IF(MID('Table'[Examples],10,1)="-","TRUE","FALSE")
VAR _3=IF(ISERROR(CONVERT(RIGHT('Table'[Examples],4),INTEGER)),"FALSE","TRUE")
Return
IF(AND(AND(_1="TRUE",_2="TRUE"),_3="TRUE"),"Match","Mismatch")

othy_bi_0-1627515718974.png

 

Did it work ? Mark it as a solution to help spreading knowledge.

A kudos would be appreciated 👍

View solution in original post

3 REPLIES 3
DataVitalizer
Super User
Super User

Hi @Anonymous 

I created for you this code which you can paste in a new calculated column to check whether the value is in the correct format

Check = 
VAR _1=IF(ISERROR(CONVERT(LEFT('Table'[Examples],9),INTEGER)),"FALSE","TRUE")
VAR _2=IF(MID('Table'[Examples],10,1)="-","TRUE","FALSE")
VAR _3=IF(ISERROR(CONVERT(RIGHT('Table'[Examples],4),INTEGER)),"FALSE","TRUE")
Return
IF(AND(AND(_1="TRUE",_2="TRUE"),_3="TRUE"),"Match","Mismatch")

othy_bi_0-1627515718974.png

 

Did it work ? Mark it as a solution to help spreading knowledge.

A kudos would be appreciated 👍

Anonymous
Not applicable

Worked perfectly, thank you!

You are welcome @Anonymous  👍

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors