6 Replies Latest reply on Mar 6, 2018 8:19 PM by djoko christianto

# Calculate the valye

Hi expert tableau

this the data i have

create a calculation field which is lookup for the same ID and KPI 'A' as the parameter

how to calculate in tableau?

thanks

 ID KPI Value AID A 10 AID B 15 AID C 9 AID D 12 AID E 8 BID A 12 BID B 10 BID C 15 BID D 18 BID E 13
• ###### 1. Re: Calculate the valye

hi Djoko,

So one way we could do this is with an LoD.

First I create the 'A' Value that (using an LoD) put it against every row for each ID

['A' Value]

{FIXED [ID]: SUM(IIF([KPI] = 'A', [Value],NULL))}

and then we can use this to create the variance

[Var from 'A']

SUM([Value]) - SUM(['A' Value])

Hope that helps and makes sense

• ###### 2. Re: Calculate the valye

Do you mean like this ?

• ###### 3. Re: Calculate the valye

This is the Key

• ###### 4. Re: Calculate the valye

Just do Value - Lookup to get the desired value

• ###### 5. Re: Calculate the valye

Hi Djoko ,

Create a calculated field by adding \concatenate "ID" & "KPI"  and name it as "Code"  .Now create that table as you have created it now and drag "Code" to marks as "Text" . Right click on "Code" available on Marks(that you have dragged ) ,go to Measure and select "Count " .