The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hallo Community,
i have the following question:
if in column Reason initial Version is written, the font color in column Reason, Version shall be green.
If in column Reason cancelled:...text is variable.... the font color in column Name, Reason, Version should be red.
I have written the following measure
Color =
Var Colortype = SELECTEDVALUE(Datenbank[Reason])
RETURN
SWITCH(TRUE),
Colortype = "initial Version",1,
Colortype = "*cancelled:* ???",1,) <--- how should i write this ??
Thx for your help
Process | Name | Ident | Area | Typ | Reason | Version |
Ab | Data Test | 232 | shop | doc | initial Version | 1.0 |
as | cancelled:Test2 | 321 | shop | doc | cancelled:update Version | 1.2 |
ds | cancelled:Test | 223 | shop | doc | cancelled: document | 3.0 |
ba | Data Test | 232 | shop | doc | initial Verrsion | 1.0 |
Solved! Go to Solution.
Use the FIND() function @Anonymous
SWITCH(
TRUE(),
Colortype = "initial Version", "Green"
FIND("cancelled", Colortype, 1, 0) > 0, "Red",
"Black"
)
If ColorType contains cancelled anywhere, it will return the place, and if > 0, will return the red color.
NOTE: FIND() is case sensitive, and doesn't support Wildcards. You night want to use SEARCH() instead, which does support wildcards, and is case-insensitive. The syntax is identical. SEARCH(TextToSearchFor, TextToSearchIn, StartPosition, ValueIfNotFound)
StartPosition for both must be >=1, and ValueIfNotFound is required in your case, otherwise it will return an error. If you return 0, then it will return false if the text isn't found.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingUse the FIND() function @Anonymous
SWITCH(
TRUE(),
Colortype = "initial Version", "Green"
FIND("cancelled", Colortype, 1, 0) > 0, "Red",
"Black"
)
If ColorType contains cancelled anywhere, it will return the place, and if > 0, will return the red color.
NOTE: FIND() is case sensitive, and doesn't support Wildcards. You night want to use SEARCH() instead, which does support wildcards, and is case-insensitive. The syntax is identical. SEARCH(TextToSearchFor, TextToSearchIn, StartPosition, ValueIfNotFound)
StartPosition for both must be >=1, and ValueIfNotFound is required in your case, otherwise it will return an error. If you return 0, then it will return false if the text isn't found.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingUser | Count |
---|---|
77 | |
75 | |
36 | |
31 | |
28 |
User | Count |
---|---|
105 | |
97 | |
55 | |
48 | |
48 |