0
votes

Could someone help me to color these measures on 3 variations - less than 0, equal to 0 and greater than 0. I tried with a calculation

IF [Margin 1] > 0 THEN 1 ELSEIF [Margin 1] < 0 THEN 2 ELSEIF [Margin 1] = 0 THEN 3 END

The reason I have assigned numbers instead of string in the above calculation is, the data is from a cube which will not allow string to be mixed with IF conditon

This is only for Margin 1 while a similar one is also required for Margin 2 and Margin 3 as well. Once I put this calculation to color shelf it colored first value of Margin 1 correctly but at the same time even colors Margin 2 and Margin 3 as well with same shade.

Could someone help to nest color logic calculation for all three Margins so I can have control to choose less than, equal to and greater than 0 in different shades.

Attached is the image of data and tableau sheet of what I have arrived as of now, do let me know for any other details

enter image description hereenter image description here

1

1 Answers

0
votes

Not sure how the fact the data is from cube makes much difference, inside of tableau you're looking at a integer and returning a string shouldn't matter.

If you want give this a try

create a calculated field like this:

ZN([Margin 1]) + ZN([Margin 2]) + ZN([Margin 3])

Then create your if statement based on the new calculated field returning string

If [NewCalculated field] <0 then

"Red"

If [NewCalculated field] 0 then

"Amber"

Else

"Green"

End

Have a go