Forum Discussion
Color coding with Multiple Colors with Multiple Text in same column
- 3 years agoColor =VAR col = SWITCH(TRUE(),CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"Letter Waived") || CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"Dispo"),"Blue", CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"Person") || CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"WebEx"),"Red")RETURNcol
I have never tried this with a text column and I do not have sample data at the moment. So you may try changing the conditions as shown below: and use numbers as you have used hitherto.
In the conditions, you can use the conditions
SWITCH(TRUE(),'Legal Files'[Description_1], "Letter Waived" || "Dispo",1,"Person" || "Webex", 2)
The '||' symbol is in this key Press Shift+this key twice
- Padycosmos3 years agoSolution Sage
Sorry about that. Please try this.
SWITCH(TRUE(),'Legal Files'[Description_1]= "Letter Waived" || "Dispo",1,'Legal Files'[Description_1]="Person" || "Webex", 2)
- inglexjc3 years agoPost Patron
Padycosmos I tired as a new Measure and as a new Column, both are not working.
As a Column:
As a Measure:
- Padycosmos3 years agoSolution Sage
If the data is not sensitive, could you please share the Power BI file, I can try
- Padycosmos3 years agoSolution Sage
A solution at last. It is a measure
- inglexjc3 years agoPost Patron
Padycosmos The data has PPI so I can not share.
What am I doing wrong?
But also notice there is other text in the Column not just the words I'm calling out, so that's part of the problem I'm having. I was able to create a measure to make when "Letter Waived" is in the text to make it all blue. But I'm not able to add if "person" or "webex" is there make it red.
- inglexjc3 years agoPost Patron
Padycosmos I tried both of these
Color =VAR COL = SWITCH(TRUE(),SELECTEDVALUE('Legal Files'[Description_1]= "Letter Waived"||SELECTEDVALUE('Legal Files'[Description_1])="Dispo","Blue",SELECTEDVALUE('Legal Files'[Description_1])= "Person","Red",SELECTEDVALUE('Legal Files'[Description_1])="WebEx","Red")RETURNCOLColor =VAR col = SWITCH(TRUE(),SELECTEDVALUE('Legal Files'[Description_1]= "Letter Waived"||SELECTEDVALUE('Legal Files'[Description_1])="Dispo","Blue",SELECTEDVALUE('Legal Files'[Description_1])= "Person","Red",SELECTEDVALUE('Legal Files'[Description_1])="WebEx","Red")RETURNcol - inglexjc3 years agoPost Patron
Padycosmos I added a ) at the end.
Color =VAR COL = SWITCH(TRUE(),SELECTEDVALUE('Legal Files'[Description_1]= "Letter Waived"||SELECTEDVALUE('Legal Files'[Description_1])="Dispo","Blue",SELECTEDVALUE('Legal Files'[Description_1])= "Person","Red",SELECTEDVALUE('Legal Files'[Description_1])="WebEx","Red"))RETURNCOLBut now getting error that "Too many arguments were passed to the SELECTEDVALUE function. The maximum argument count for the function is 2. - Padycosmos3 years agoSolution Sage
This works even if the text contains other values.
- inglexjc3 years agoPost PatronColor =VAR col = SWITCH(TRUE(),SELECTEDVALUE('Legal Files'[Description_1]= "Letter Waived"||SELECTEDVALUE('Legal Files'[Description_1])="Dispo","Blue",SELECTEDVALUE('Legal Files'[Description_1])="Person"||SELECTEDVALUE('Legal Files'[Description_1])="WebEx","Red")RETURNcolStill get error.
- Padycosmos3 years agoSolution SageThis worksColor =VAR col = SWITCH(TRUE(),CONTAINSSTRING(SELECTEDVALUE(Orders[Category]),"Fur")||CONTAINSSTRING(SELECTEDVALUE(Orders[Category]),"Off"),"Red",CONTAINSSTRING(SELECTEDVALUE(Orders[Category]),"Tech"),"Yellow")RETURNcol
- Padycosmos3 years agoSolution SageColor =VAR COL = SWITCH(TRUE(),CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"LetterWaived")||CONTAINSSTRING(SELECTEDVALUE('LegalFiles'[Description_1]),"Dispo"), "Blue",CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]), "Person")||CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"WebEx"),"Red"))RETURNCOL
- Padycosmos3 years agoSolution SageColor =VAR col = SWITCH(TRUE(),CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"Letter Waived") || CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"Dispo"),"Blue", CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"Person") || CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"WebEx"),"Red")RETURNcol