Forum Discussion
kokoro_1202
Helper I
5 years agohelp on conditional formatting or nested if
hi all
I have a list of customer id from the system which is not accurate, is it possible to achieve the following with power bi as a new column? Any advice is appreciated.
Thank you so much!
Try the following formula:
New Column = SWITCH( TRUE(), LEFT(Table[CustomerID],1) = "w" , Table[CustomerID], LEFT(Table[CustomerID],3) = "000" , "u" & Table[CustomerID], LEN(Table[CustomerID]) = 3 , "z" & Table[CustomerID], "Other" )
7 Replies
- themistoklis
Community Champion
Try the following formula:
New Column = SWITCH( TRUE(), LEFT(Table[CustomerID],1) = "w" , Table[CustomerID], LEFT(Table[CustomerID],3) = "000" , "u" & Table[CustomerID], LEN(Table[CustomerID]) = 3 , "z" & Table[CustomerID], "Other" )- kokoro_1202
Helper I
how shoulld the formula be to "a" to replace 000 i tried replace but it doesnt work?
Replace = (Table[CustomerID],1,3,"a"),
could you advice me again?- AnonymousNot applicable
Hi kokoro_1202
This might help your requirement
Result = If ( Len(Cust[CustomerID]) = 3 , "Z" & Cust[CustomerID] , IF( LEFT(Cust[CustomerID],3) = "000" , "U"&SUBSTITUTE(Cust[CustomerID],"000","a"),Cust[CustomerID]))
- AnonymousNot applicable
1. Create a new column for Result field
Result = If ( Len(Cust[CustomerID]) = 3 , "Z" & Cust[CustomerID] , IF( LEFT(Cust[CustomerID],3) = "000" , "U"&Cust[CustomerID],Cust[CustomerID]))
2. Create an another column for font formatting.FontId = If ( Len(Cust[CustomerID]) = 3 , 1 , IF( LEFT(Cust[CustomerID],3) = "000" , 2 ,3))3. Go to format pane and select Value "Result" from Conditional Formatting pane and enable Font color and follow as per the below screenshot