Forum Discussion
kokoro_1202
5 years agoHelper I
help 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 mu...
- 5 years ago
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
5 years agoHelper I
Tried the following, but it say "Function 'SWITCH' does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values."
New Column =
SWITCH( TRUE(),
LEFT(Table[CustomerID],1) = "w" , Table[CustomerID],
REPLACE(Table[CustomerID],1,3,"a"),
LEN(Table[CustomerID]) = 3 , "z" & Table[CustomerID],
"Other"
)
themistoklis
5 years agoCommunity Champion
Try this:
New Column =
SWITCH( TRUE(),
LEFT(Table[CustomerID],1) = "w" , Table[CustomerID],
LEFT(Table[CustomerID],3) = "000" , REPLACE(Table[CustomerID],1,3,"a"),
LEN(Table[CustomerID]) = 3 , "z" & Table[CustomerID],
"Other"
)