March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I am validating a field, this field should only composed of letters(any and/or numbers, no any other character like -,_@,$%^& etc.
Valid letters/numbers: ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789’
Help appreciated and thanks in advance.
Solved! Go to Solution.
Hi, @NewinPBi
Based your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Valid:
You may create a calculated column or a measure as below.
Calculated colummn:
IsValid Column =
var _letter = 'Table'[Validation]
var tab =
ADDCOLUMNS(
GENERATESERIES(1,LEN(_letter),1),
"letter",
RIGHT(LEFT(_letter,[Value]),1)
)
return
IF(
LEN(_letter)=
COUNTROWS(
FILTER(
tab,
[letter] in DISTINCT(Valid[Valid letter])
)
),
1,0
)
Measure:
IsValid Measure =
var _letter = MIN('Table'[Validation])
var tab =
ADDCOLUMNS(
GENERATESERIES(1,LEN(_letter),1),
"letter",
RIGHT(LEFT(_letter,[Value]),1)
)
return
IF(
HASONEVALUE('Table'[Validation]),
IF(
LEN(_letter)=
COUNTROWS(
FILTER(
tab,
[letter] in DISTINCT(Valid[Valid letter])
)
),
1,0
)
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @NewinPBi
If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.
Best Regards
Allan
Hi, @NewinPBi
Based your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Valid:
You may create a calculated column or a measure as below.
Calculated colummn:
IsValid Column =
var _letter = 'Table'[Validation]
var tab =
ADDCOLUMNS(
GENERATESERIES(1,LEN(_letter),1),
"letter",
RIGHT(LEFT(_letter,[Value]),1)
)
return
IF(
LEN(_letter)=
COUNTROWS(
FILTER(
tab,
[letter] in DISTINCT(Valid[Valid letter])
)
),
1,0
)
Measure:
IsValid Measure =
var _letter = MIN('Table'[Validation])
var tab =
ADDCOLUMNS(
GENERATESERIES(1,LEN(_letter),1),
"letter",
RIGHT(LEFT(_letter,[Value]),1)
)
return
IF(
HASONEVALUE('Table'[Validation]),
IF(
LEN(_letter)=
COUNTROWS(
FILTER(
tab,
[letter] in DISTINCT(Valid[Valid letter])
)
),
1,0
)
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @NewinPBi ,
You can try this custom column:
let _validItems = {"0".."9"} & {"A".."Z"} in
if Text.Length(Text.Remove(Text.Upper([Text]), _validItems)) > 0 then 0 else 1
This works as a custom column, but I am trying to achieve this using an existing column name VALIDATION, I have other IF conditions too on other fields
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
86 | |
73 | |
57 | |
52 |
User | Count |
---|---|
197 | |
133 | |
107 | |
69 | |
65 |