This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
Looking for some assistance with understanding how to apply conditionals based on value naming conventions. We have a standard naming convention that needs to be followed with several variations as follows:
X-XXXX
X-XXXX-X
X-XXXX-XXXX
X-XXXX-XXXX-X
X-XXXX-XXXX-XXXX
etc.
A quick look at the values I'm dealing with is shown below where green highlight is good, red is bad.
What are the best and easiest ways to achieve within PowerBI?
Thanks!
Steve
Solved! Go to Solution.
Hi @swalz - you can achieve by creating a calculated column or measure in Power BI that applies a pattern-matching logic
Hope this helps.
Proud to be a Super User! | |
Hi, @swalz
Thanks for Ritaf1983 and rajendraongole1 reply. You can refer to their reply, or you can try the following way.
1. Add a new column to remove non-alphanumeric characters in Power Query
Text.Select([Column1], {"A".."Z", "a".."z"})
2. Write the following dax to create a calculate column
Format =
VAR NameLength =
LEN ( [Name] )
VAR FirstChar =
LEFT ( [Name], 1 )
VAR RemainingChars =
MID ( [Name], 2, NameLength - 1 )
VAR FormattedRemainingChars =
CONCATENATEX (
GENERATESERIES ( 1, LEN ( RemainingChars ), 4 ),
MID ( RemainingChars, [Value], 4 ),
"-"
)
RETURN
FirstChar & "-" & FormattedRemainingChars
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @swalz - you can achieve by creating a calculated column or measure in Power BI that applies a pattern-matching logic
Hope this helps.
Proud to be a Super User! | |
Hi @swalz
What is the logic of the conditions of the wanted coloring?
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 25 | |
| 23 | |
| 19 | |
| 17 | |
| 14 |
| User | Count |
|---|---|
| 24 | |
| 20 | |
| 20 | |
| 19 | |
| 19 |