2 Replies Latest reply on Nov 1, 2018 6:33 AM by Niklas Axelsson

# Difference between two values - same Dimension, same Measure - Continued

Hi everyone,

This is the first ever question I have asked in Tableau, so please bare with me!

I am currently trying to calculate the difference between two columns, using the same dimension and measure. Basically what I want to do is having the Excel-equivalent of just a simple "difference between two columns" calculation.

I found (sort of) an answer using this previously asked question, with a lot of suggested solutions:

Difference between two values - same Dimension, same Measure

I used it as so:

The resulting table looks like:

Everything here looks fine where there is a number/value for the measure [Market Val Pct Adjusted] in both PF and PF Benchmark.

However, when there is a NULL value (or missing value) in [Market Val Pct Adjusted] in the PF portfolio (Portfolio Name dimension), i.e. when there is only a valid value in the PF Benchmark dimension - instead of showing

(0.0 - 0.09) = -0.09

for the Subsector D in the Total-column, it shows positive 0.09... I have already tried to use zn() functionality for the [Market Val Pct Adjusted] field, as well as trying to replace all NULLs with zeros using zn(lookup(sum([[Market Val Pct Adjusted]]), 0)) with no good results.

Anyone out there having a clue on how to fix this, rather annoying, issue?

I can't attach any example atm, as the data is sensitive and non-public. The only re-usable data available is the one uploaded in the previous-mentioned example above (Difference between two values - same Dimension, same Measure )

Thanks,

/N

• ###### 1. Re: Difference between two values - same Dimension, same Measure - Continued

Hi,

Tableau does not manage NULL value as Zero.

May I suggest you to replace Null value by 0 and double check?

Cedric

• ###### 2. Re: Difference between two values - same Dimension, same Measure - Continued

Hi,

I get the same result by interchanging NULL with 0.0 as:

And as mentioned in the question, I have tried explicitly "telling Tableau" to interchange NULL with zero for the actual value, with no result either...

Thanks