5 Replies Latest reply on Sep 15, 2018 1:48 AM by Simon Runc

# Subtracting two measures

Hello All,

I have created two calculated fields to get number of recs to be prepared and approved. Now I want to find the difference between these two.

My First Calculated field "Calculation2 " - IF [Team (group)]="Recs to be prepared by CapG" Then[Number of Records]END  = Value 2583

My Second Calculated Field "Calculation3 " = IF [Category]= "Uploaded" And [WDS] <> "-" THEN[Number of Records]END = Value 2099

I wrote another calculated field [Calculation3] - [Calculation2] but I am not getting value as Zero.

Need Help

Regards,

Chandrakanth.K

• ###### 1. Re: Subtracting two measures

I assume that when you bring the Calculation 2 and Calculation 3 into your canvas they are aggregated using SUM.

In which case you'll need to also wrap your difference in SUMs too

SUM([Calculation3]) - SUM([Calculation2])

Hope that does the trick

• ###### 2. Re: Subtracting two measures

Hello Simon,

It worked. I tried using SUM before posting this in forum and it don't work that time. But now its worked.

Magic

Thank you

Regards,

Chandrakanth.K

• ###### 3. Re: Subtracting two measures

Hello Simon,

How do I treat nulls? In my table I have null. I am unable to get values for cells where I have nulls. I wrote calculated field as SUM([Uploaded])-SUM([Rejects]).

I tried ISnull but its not working

Regards,

Chandrakanth.K

• ###### 4. Re: Subtracting two measures

Hello Simon,

I used Zn and its working.

Regards,

Chandrakanth.K

• ###### 5. Re: Subtracting two measures

So if you just want to treat them as zeros, you can just wrap your Calcs in

a ZN

Ah just seen you’ve found that!!

You could have instead put an else statement to 0 in your original formulas

If =“something” then  else 0 end

On Sat, 15 Sep 2018 at 09:19, chandrakanth k <tableaucommunity@tableau.com>