Tableau Color indicator to compare sales previous day to today.
The calculation uses LOOKUP function to get the rate for previous day.
(It is like Today's value - Previous days value)/Previous days absolute value.
If the above > 0 then "Color1"
Else If the above <0 then "Color2"
IF
(ZN(([Success Rate])) - LOOKUP(ZN(([Success Rate])), -1)) / ABS(LOOKUP(ZN(([Success Rate])), -1))=0 then
"white"
ELSEIF
(ZN(([Success Rate])) - LOOKUP(ZN(([Success Rate])), -1)) / ABS(LOOKUP(ZN(([Success Rate])), -1))>0 then
"green"
ELSEIF
(ZN(([Success Rate])) - LOOKUP(ZN(([Success Rate])), -1)) / ABS(LOOKUP(ZN(([Success Rate])), -1))<0 then
"red"
END
(ZN(([Success Rate])) - LOOKUP(ZN(([Success Rate])), -1)) / ABS(LOOKUP(ZN(([Success Rate])), -1))=0 then
"white"
ELSEIF
(ZN(([Success Rate])) - LOOKUP(ZN(([Success Rate])), -1)) / ABS(LOOKUP(ZN(([Success Rate])), -1))>0 then
"green"
ELSEIF
(ZN(([Success Rate])) - LOOKUP(ZN(([Success Rate])), -1)) / ABS(LOOKUP(ZN(([Success Rate])), -1))<0 then
"red"
END
Comments
Post a Comment