7 Replies Latest reply on Apr 11, 2016 6:09 AM by msa s

# calculations - need suggestions

Hi

I am going through the LOD's

2nd one in this link :Tableau 9 Preview: Introduction to Level of Detail Expressions | Tableau Software

what does this formulae retrieve : ????

SUM(IIF([Difference Between Actual and Target] > 0, 1, 0)) /

COUNTD([Product]) • ###### 1. Re: calculations - need suggestions

Please attach the workbook as twbx. The field [Difference Between Actual and Target] is a calculated field and we need to know the expression, before we comment.

Thanks,

Manideep

• ###### 2. Re: calculations - need suggestions

0, 1, 0 what is this one

• ###### 3. Re: calculations - need suggestions

IIF([Difference Between Actual and Target] > 0, 1, 0) means if the Calculated Expression returns a value >  0 then the assigned value will be 1 else for all condition, this should return a 0.

Here we are creating a Binary field based on a numeric field.

Thanks,

Manideep

- If this solve your doubt then mark this as correct answer to close the thread.

• ###### 4. Re: calculations - need suggestions

FOR CALIFORNIA,

7340-6480= 860 IS DIFFERENCE, HOW IS THE 66.7% CALCULATED ?

• ###### 5. Re: calculations - need suggestions

To get the difference you have to create a calculate field as follows (LOD)

{INCLUDE [Product] : SUM([Profit]) - SUM([Target Profit])}

Then that percentage is Percentage of area codes above targets

For that you need to create another calculated field

SUM(IIF ([Above Calculated Field]>0,1,0)) / COUNTD([Product])

Please note, your data set may be different to the one used in the example. So you may not get 66.7%

• ###### 6. Re: calculations - need suggestions

With your reference file you should get 66.7%. Please check the attached workbook

• ###### 7. Re: calculations - need suggestions

excel sheet if you click view data and export all then you get same sheet thats what i have attached     by saving as ACTTARGET