5 Replies Latest reply on Nov 13, 2016 11:37 PM by Marc MOUSSA

# Comparison in If

Hi I am comparing two aggregated variables in Tableau.

following is the output based on analysis ->view data

so if column F>column E : Bright Red

else Light Blue

Here, you can see on basis of Column H(IF(F2>E2,1,0), even when COlumn F is less than E, bright red is being allotted.how ? why ?

Can someone help me on solving this.

• ###### 1. Re: Comparison in If

Can you post a workbook with a small dataset, it will be easier to answer you question.

• ###### 2. Re: Comparison in If

Hi Marc,

Unfortunately I am working on confidential data.SO cant share.Also, the data file is 450MB(huge), hence cleaning data for this will itself require humongous effort.

Anyway,this is what my logic is :

IF (((COUNTD([SiteSerial])) / (TOTAL(COUNTD([SiteSerial]))))) >((SUM([Calc R SITE Quarter]))/(SUM([Calc SITE Quarter])))then "Bright Red"

ELSE "Light Blue" END

Calc R SITE Quarter

Calc SITE Quarter

are both calculated using fixed function.(countd)

Color coding is not reflecting correctly in the final chart.

• ###### 3. Re: Comparison in If

Column A         Column B

I managed to put everything in percentage.Then too comparison not going well.Has anyone encountered this issue ?

Logic : if Column A > Column B = Bright red

Else : Light Blue

• ###### 4. Re: Comparison in If

Hey,

You must start by creating 4 calculated fields with the 4 segments of the equation.

Doing that will help you see, why you're not getting the desired result.

• ###### 5. Re: Comparison in If

Add a column With the equation Column A > Column B to see what it shows.

Do that by referencing the 2 calculated fields.