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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
InsightSeeker
Helper III
Helper III

Help Needed: DAX Formula to Validate Alphanumeric Values

Hello - I need help with validating values using DAX to determine if they contain only alphanumeric characters.

If the value contains only alphanumeric characters, it should return TRUE; otherwise, it should return FALSE.

 

Value
gtest@gmail.com
16546854
 
1641654
564646
646464
546498
 
64646464
646486
64646546
ASW4646464
AW54646
AQ464654
AD446464
AS4646DD
ASDSWSD
 
OJOJ
POJPOJP

 

1 ACCEPTED SOLUTION

You can add a special case for blanks but they didn't cause an issue in my testing.

 

AlexisOlson_0-1724251338517.png

 

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

DAX is not a very good tool for this. I'd recommend doing it in Power Query or further upstream (e.g. SQL).

 

It is possible though. You can iterate through all the characters and see if each one a letter or number.

 

Something like this as a calculated column:

 

IsAlphanumeric =
VAR _AlphaNum = "abcdefghijklmnopqrstuvwxyz0123456789"
VAR _L = LEN ( Table1[Value] )
VAR _Series =
    SELECTCOLUMNS ( GENERATESERIES ( 1, _L, 1 ), "@N", [Value] )
VAR _AllChars =
    ADDCOLUMNS ( _Series, "@Char", MID ( Table1[Value], [@N], 1 ) )
VAR _AlphaNumChars =
    FILTER ( _AllChars, CONTAINSSTRING ( _AlphaNum, [@Char] ) )
VAR _Result =
    ( L = COUNTROWS ( _AlphaNumChars ) )
RETURN
    _Result

 

Hi @AlexisOlson - I am getting the following error. Could it be because some of the cells are blank? How can this be handled?

 

The arguments in GenerateSeries function cannot be blank.

 

Thanks

 

You can add a special case for blanks but they didn't cause an issue in my testing.

 

AlexisOlson_0-1724251338517.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.