Forum Discussion
jwyoung07
2 years agoNew Member
Adding a column label based on text value
Hello, I hope my question is an easy one. I've been poking around the forums and reviewing documentation but can't wrap my head around the best way to do this: I have a list of names for items, and w...
- 2 years ago
Update for all: I was able to find a working solution to the problem: a (very long) conditional column:
The result is a very ugly string of if statements in a single Power Query, but it accomplished exactly what I was trying to do. Thank you!
mlsx4
2 years agoMemorable Member
Hi jwyoung07
I'm not sure if I have understood it correctly. But, I think you can create a new custom column:
Name Category =
var searchCat =
LEFT(
'MyTable'[Item],
SEARCH(
"-",
MyTable[Item],
,
LEN(MyTable[Item]) + 1
) - 1
)
return SWITCH(searchCat,
"Red","Winners",
"Blue","Losers",
"Yellow","Participators",
"Purple","Try-Hards",
"No category")
I hope it works!