Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
HI,
I am creating a calculated column called 'LOC_conditionalFormat' that assigns a value based on two other columns. Here is my current code:
Solved! Go to Solution.
Try:
LOC_conditionalFormat =
SWITCH (
TRUE (),
OR (
ISBLANK ( 'Loneliness All Data'[Locus Of Control Mean] ),
ISBLANK ( 'Loneliness All Data'[LOC Previous Year] )
), 4,
'Loneliness All Data'[Locus Of Control Mean] > 'Loneliness All Data'[LOC Previous Year], 1,
'Loneliness All Data'[Locus Of Control Mean] < 'Loneliness All Data'[LOC Previous Year], 2,
'Loneliness All Data'[Locus Of Control Mean] = 'Loneliness All Data'[LOC Previous Year], 3,
0
)
Proud to be a Super User!
Paul on Linkedin.
Try:
LOC_conditionalFormat =
SWITCH (
TRUE (),
OR (
ISBLANK ( 'Loneliness All Data'[Locus Of Control Mean] ),
ISBLANK ( 'Loneliness All Data'[LOC Previous Year] )
), 4,
'Loneliness All Data'[Locus Of Control Mean] > 'Loneliness All Data'[LOC Previous Year], 1,
'Loneliness All Data'[Locus Of Control Mean] < 'Loneliness All Data'[LOC Previous Year], 2,
'Loneliness All Data'[Locus Of Control Mean] = 'Loneliness All Data'[LOC Previous Year], 3,
0
)
Proud to be a Super User!
Paul on Linkedin.
@PaulDBrown Just wondering if you could help with one more addition to the solution you provided? How would I adjust your solution so that LOC_conditionalFormat didn't create a value for every row but only on rows where another column [Variable] contained the letters 'PC'?
Try:
LOC_conditionalFormat =
IF (
CONTAINSSTRING ( MAX( Table[Variable] ) , "PC" ),
SWITCH (
TRUE (),
OR (
ISBLANK ( 'Loneliness All Data'[Locus Of Control Mean] ),
ISBLANK ( 'Loneliness All Data'[LOC Previous Year] )
), 4,
'Loneliness All Data'[Locus Of Control Mean] > 'Loneliness All Data'[LOC Previous Year], 1,
'Loneliness All Data'[Locus Of Control Mean] < 'Loneliness All Data'[LOC Previous Year], 2,
'Loneliness All Data'[Locus Of Control Mean] = 'Loneliness All Data'[LOC Previous Year], 3,
0
)
)
Proud to be a Super User!
Paul on Linkedin.
Hi @PaulDBrown , when I use your code it only creates empty cells. Not sure why! I will maybe repost this as a new question!
What is the actual syntax for the [Variable] you mentioned? Is it a measure or column? If it's a column, what is the syntax?
the MAX(Table[Variable]) was an assumption on my part, and is probably why you are getting blanks
Proud to be a Super User!
Paul on Linkedin.
Hi Paul,
I was able to get this code to do what I wanted: