Forum Discussion
swalz
1 year agoNew Member
Conditionals Help
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 f...
- 1 year ago
Hi swalz - you can achieve by creating a calculated column or measure in Power BI that applies a pattern-matching logic
IsValidName =SWITCH(TRUE(),-- X-XXXX (Length = 6)LEN([NamingConvention]) = 6 && MID([NamingConvention], 2, 1) = "-", 1,-- X-XXXX-X (Length = 😎LEN([NamingConvention]) = 8 && MID([NamingConvention], 2, 1) = "-" && MID([NamingConvention], 7, 1) = "-", 1,-- X-XXXX-XXXX (Length = 11)LEN([NamingConvention]) = 11 && MID([NamingConvention], 2, 1) = "-" && MID([NamingConvention], 7, 1) = "-", 1,-- X-XXXX-XXXX-X (Length = 13)LEN([NamingConvention]) = 13 && MID([NamingConvention], 2, 1) = "-" && MID([NamingConvention], 7, 1) = "-" && MID([NamingConvention], 12, 1) = "-", 1,-- X-XXXX-XXXX-XXXX (Length = 16)LEN([NamingConvention]) = 16 && MID([NamingConvention], 2, 1) = "-" && MID([NamingConvention], 7, 1) = "-" && MID([NamingConvention], 12, 1) = "-", 1,-- If none of the patterns match0)i am using table chart in format pane to go the cell element apply the new column condition 1 for good and 0 for bad. i am using dark color you can choose your colors as per your requestHope this helps.