Forum Discussion
Validate numeric values and 8 digits length
- Anonymous5 years ago
Hi gauravnarchal ,
If you want to use meausre, please refer to what mahoneypat said and rewrite the formula to look like this:
Measure = IF( LEN(MAX('Table1'[Serial No])) = 8 && IFERROR(VALUE(MAX('Table1'[Serial No])), 0)>0,"Valid", "Error")
You can also use the m language of Power QueryHere are the steps you can follow:
1. Enter the Power query through Transform data and select Add Column – Custom Column
2. Enter the code
if List.AllTrue({Text.Length([Serial No]) = 8 ,Value.Is(Value.FromText([Serial No]), type number)}) then "corrert" else "error"3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi gauravnarchal ,
If you want to use meausre, please refer to what mahoneypat said and rewrite the formula to look like this:
Measure =
IF(
LEN(MAX('Table1'[Serial No])) = 8
&&
IFERROR(VALUE(MAX('Table1'[Serial No])), 0)>0,"Valid", "Error")
You can also use the m language of Power Query
Here are the steps you can follow:
1. Enter the Power query through Transform data and select Add Column – Custom Column
2. Enter the code
if
List.AllTrue({Text.Length([Serial No]) = 8 ,Value.Is(Value.FromText([Serial No]), type number)})
then
"corrert"
else
"error"
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly