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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SS_1122
Frequent Visitor

Create a calculated measure to check if the data has only letters

Hi All,

I am trying to create a measure to calculate the validity of the data. The data is as below :

Name 1 Name 2 
MarkSa
LeaMousk
M9rg89Page
K**aJules
Sasha'sOvam
MM
DeeDee

 
The calculated field I want to create basically will check the following:
The Name1 should contain only letters and no symbols like (@,£,$,9,10,11 etc) but can contain ( ' ), Second it should not be same as Name2 , if these conditions are met then it is valid otherwise invalid.


Name 1 Name 2 Validity
MarkSaValid
LeaMouskValid
M9rg89PageInvalid
K**aJulesInvalid
Sasha'sOvamValid
MMInvalid
DeeDeeInvalid

Thanks


1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @SS_1122 ,

 

You can create another calculated column.

Column = IF('Table'[Name 1 ] = BLANK()  ,"BLANK",'Table'[Validity])

 

vtangjiemsft_0-1678181533335.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @SS_1122 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a calculated column.

Validity = var _aaa = UNION(GENERATESERIES(UNICODE("A"),UNICODE("Z")),GENERATESERIES(UNICODE("a"),UNICODE("z")),{UNICODE("'")})
var _a = LEN([Name 1 ])
var _b = GENERATESERIES(1,_a,1)
var _c = ADDCOLUMNS(_b,"Character",MID([Name 1 ],[Value],1))
var _d = ADDCOLUMNS(_c,"Flag",IF(UNICODE([Character]) in SELECTCOLUMNS(_aaa,"Unicode",[Value]),0,1))
return  IF(SUMX(_d,[Flag])=0 && 'Table'[Name 1 ] <> 'Table'[Name 2 ] ,"valid","invalid")

(3) Then the result is as follows.

vtangjiemsft_0-1678176785396.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Hey Neeko - Thanks for your reply, I w=am positive that this should work, but I have one query what if I have blank data in between , in that case it shows the error like "The arguments in GenerateSeries function cannot be blank"

So for example if I have something like this 

Name 1 Name 2 
MarkSa
LeaMousk
M9rg89Page
K**aJules
Sasha'sOvam
MM
 

Poppins

Dee

Dee

 


The results should  be like 

Name 1 Name 2 Validity
MarkSaValid
LeaMouskValid
M9rg89PageInvalid
K**aJulesInvalid
Sasha'sOvamValid
MMInvalid
 PoppinsBlank
DeeDeeInvalid

 

Anonymous
Not applicable

Hi @SS_1122 ,

 

You can create another calculated column.

Column = IF('Table'[Name 1 ] = BLANK()  ,"BLANK",'Table'[Validity])

 

vtangjiemsft_0-1678181533335.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

"The arguments in GenerateSeries function cannot be blank" I keep getting this error 

Hi @SS_1122 ,

You will have to handle the NULL as BLANK in the Name1 Column before creating the Calculated Column to known if it is Valid or Invalid record. Also you should be using this New Column where the NULL is handled in the Calculated Column.

Column1 = IF('Table'[Name 1 ] = BLANK()  ,"BLANK",'Table'[Name 1 ])

Thejeswar_0-1678184001769.png

 

Anonymous
Not applicable

Hi @SS_1122 ,

 

Please check your data type, refer to my PBIX, is your data different? If the error is still reported, please provide a simplified PBIX file (take care to protect your private data)

vtangjiemsft_0-1678182246954.png

You can refer to the following post that may be helpful to you:

Challenge : how to generate a table spliting each ... - Microsoft Power BI Community

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.