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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
gauravnarchal
Post Prodigy
Post Prodigy

Cell Validation

Dear All

 

I want to create a measure to find if any cell value is having more than 1 character (A-Z), then it should return that as an error.

 

Digits are also not accepted as a value and should return that as an error. Only valid value in the cell should be a single character.

 

Indicator
A
B
C
D
DD
EE
2
3
E

 

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @gauravnarchal ,

 

Try the following measure:

 

Measure = 
SWITCH (
    TRUE ();
    ISERROR ( MOD ( SELECTEDVALUE ( 'Table'[Indicator] ); 2 ) ) = FALSE; "ERROR";
    LEN ( SELECTEDVALUE ( 'Table'[Indicator] ) ) > 1; "ERROR";
    "OK"
)

 

MFelix_0-1600171535799.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

Hi @gauravnarchal ,

 

Try the following code:

Measure = 
SWITCH (
    TRUE ();
    ISERROR ( MOD ( SELECTEDVALUE ( 'Table'[Indicator] ); 2 ) ) = FALSE; "ERROR";
    SELECTEDVALUE ( 'Table'[Indicator] ) = BLANK(); "ERROR";
    LEN ( SELECTEDVALUE ( 'Table'[Indicator] ) ) > 1; "ERROR";
    "OK"
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@gauravnarchal , refer if this solution from the past can help

https://community.powerbi.com/t5/Desktop/Testing-if-a-string-ONLY-contains-letters/td-p/460989

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
MFelix
Super User
Super User

Hi @gauravnarchal ,

 

Try the following measure:

 

Measure = 
SWITCH (
    TRUE ();
    ISERROR ( MOD ( SELECTEDVALUE ( 'Table'[Indicator] ); 2 ) ) = FALSE; "ERROR";
    LEN ( SELECTEDVALUE ( 'Table'[Indicator] ) ) > 1; "ERROR";
    "OK"
)

 

MFelix_0-1600171535799.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Hi @MFelix - Thank you for your help. It did work.

 

One last questions - How can i add a rule to return error for blank cells?

 

So now - Cell value with more than 1 character or Digits or blank cells are not accepted as a value and should return that as an error. 

 

Once again, thank you for your help.

 

Regards

Gaurav

Hi @gauravnarchal ,

 

Try the following code:

Measure = 
SWITCH (
    TRUE ();
    ISERROR ( MOD ( SELECTEDVALUE ( 'Table'[Indicator] ); 2 ) ) = FALSE; "ERROR";
    SELECTEDVALUE ( 'Table'[Indicator] ) = BLANK(); "ERROR";
    LEN ( SELECTEDVALUE ( 'Table'[Indicator] ) ) > 1; "ERROR";
    "OK"
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





dobregon
Impactful Individual
Impactful Individual

Hi,

 

Something that you can do is
1. Create a column that show you how many characteres the other column has for each row. Using LEN(Columnname). you can create if(len(column)>1,"error","ok")

2. Create a measure taking into account the new column



Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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