1 Reply Latest reply on Apr 23, 2018 10:13 AM by khadeer.shaik.0

    Calculating Difference between Two Variables from One Column

    Guen Pak

      Hey guys,

       

      Could someone help me with Calculating a difference between two Measures, BUT - The difference is coming from two variables in one column.

      So, I have a column called "Category" and there are only two Variables in there called HELOC 2017 and HELOC 2018.  And I want to calculate the Difference from the measure called "Target Group %" by "Category".

       

      I have tried several methods.

      First, I used Tableau's default difference calculation and made changes on the table calculations.

      ZN(SUM([Target Perct 2017])) - LOOKUP(ZN(SUM([Target Perct 2018])), 0)

      This works BUT- I cant view by "Category".

      Screen Shot 2018-04-23 at 12.31.54 PM.pngScreen Shot 2018-04-23 at 12.27.54 PM.png

       

      I also made 3 Calculated Measures, They are:

      1. IF [Target] = "HELOC Category 2017" THEN [Target group %] ELSE NULL END

      2. IF [Target] = "HELOC Category 2018" THEN [Target group %] ELSE NULL END

      3. [Target Perct 2017]-[Target Perct 2018]

      But the 3rd Calculated Measure gives me a null value.

      The first Screen shot is ultimately what i want but to show that across my Target Dimension Column correctly.

       

      Any help would be greatly appreciated.