Skip to main content

Hello,

 

I am having trouble adding 2 calculated fields together within Tableau.  Both of the calculations are using data from the same data source, an excel spreadsheet.

 

Here are the 2 calculations:

 

Total 1 Calc:

if CONTAINS([Object Code Short Title],"BUDGET")=false

and STARTSWITH([Object Code Short Title],"BF")=false

and CONTAINS([Object Code Short Title],"INCOME")=false

and STARTSWITH([Object Code Short Title],"INTRA")=false

and STARTSWITH([Object Code Short Title],"MATERIAL")=false

and[Object Code Short Title]<>"PLANT ENCUMB"

and [Object Code Short Title]<>"ENCUMBRAN -BFW"

then

Case [Sub Acct]

when "430" then [System 1 Amount]

when "520" then [System 1 Amount]

when "541" then [System 1 Amount]

when "576" then [System 1 Amount]

when "528" then [System 1 Amount]

when "745" then [System 1 Amount]

when "860" then [System 1 Amount]

when "861" then [System 1 Amount]

when "852" then [System 1 Amount]

when "833" then [System 1 Amount]

when "894" then [System 1 Amount]

else 0

end end *-1

 

Total 2 Calc:

If [Group Number]<>"8640"

and [Group Number]<>"8640"

and [Group Number]<>"8630"

and [Group Number]<>"8637"

and [Group Number]<>"8643"

and [Group Number]<>"8650"

and [Group Number]<>"2098"

then

If [Sub Acct]="09" or [Sub Acct]="10" or [Sub Acct]="14" or [Sub Acct]="20" then

Case [Object Code]

when "022100" then [System 1 Amount]

when "122108" then [System 1 Amount]

when "122110" then [System 1 Amount]

when "122120" then [System 1 Amount]

when "112322" then [System 1 Amount]

when "113328" then [System 1 Amount]

when "144131" then [System 1 Amount]

when "115534" then [System 1 Amount]

when "116635" then [System 1 Amount]

when "113336" then [System 1 Amount]

when "114443" then [System 1 Amount]

when "117886" then [System 1 Amount]

when "118990" then [System 1 Amount]

when "114385" then [System 1 Amount]

when "115692" then [System 1 Amount]

when "117698" then [System 1 Amount]

when "135466" then [System 1 Amount]

else 0

end

end

end *-1

 

After creating these calculations, we then tried adding the 2 together to get a total of the 2.

 

Total both calculation:

[Total 2 Calc]*1+[Total 1 Calc]*1

 

The "Total both calculation" only returns the value of "Total 2 Calc".

 

I can't share the workbook, but I'm hoping that someone can provide an easy explanation as to why my "Total both calculation" is not working and if there is a way to add the 2 calculations together.

 

Thank you!

2 answers
0/9000