I assume you are switching measures on the Y-axis using a parameter and calculated field?
If so simply reference the calculated field in your IF statement rather than TCU? Are TCU and competition on the same scale and is 0 the switch in both cases?
Or is the question how to switch the Y-Axis in the first place?
Post the sample twbx file do that we can try
IF ATTR([Industry])>0 and ATTR([TCU]/[Competition])>0 THEN 'MoreGreen'
ELSEIF ATTR([Industry])<0 and ATTR([TCU]/[Competition])<0 THEN 'DarkRed'
ELSEIF ATTR([TCU]/[Competition])<0 then 'red'
ELSEIF ATTR([TCU]/[Competition])>0 THEN 'Green'
Yes I have used Parameter and Calculated field formula as above.But, I am only getting 2 colors Green and Dark Green.
Please let me know if the above formula needs any changes.
Go through the below link, it will help you how to write conditions in Tableau.
1) You have to create a calculated field using Parameter to show the specific measure on the view.
Name: Selected KPI
Syntax: if [Parameter] = "TCU" then [TCU]
2) Use the the above calculated field & make a calculation.
if [Industry] >0 and [Selected KPI] >0 then "More Green"
elseif [Industry] <0 and [Selected KPI] >0 then "DarkRed"
elseif [Selected KPI] >0 then "Green"
elseif [Selected KPI] <0 then "Red"
I got the desired result in my approach
Once you find the Solution from any one' post, then mark it as "Answered", else you get the answer yourself then share the solution in the forum for future references.
Eventually close the thread.