1 Reply Latest reply on Oct 9, 2013 8:00 AM by Matt Lutton

    Adding a new variable to database and using it further for calculations

    Mayank Ahuja



      I am using Tableau desktopn and i have a following query.

      I need to create a variable and further use that variable for different computation.Below is an example.


      I have a database with following columns

      Region Division Date Spends

      A1          D1      d1    10

      A1          D2      d1    20

      A2          D1      d1   10

      A2          D2      d1    20


      Now i need to create a variable(Avg_spends) which is average of spends across different regions which i am able to do using "Create Calculated field" and my data now looks like this


      Division Date Avg_Spends

      D1          d1     10

      D2          d1     20 


      Now if i need to roll this data up to division level and see spends across all division, i want to take the sum of Avg_spends and the resulting data should be 

      Date Avg_Spends

      d1     30


      Now if i try to create this last table in tableau, answer i am getting is

      Date Avg_spends

      d1      15.5


      Apologies if this is something very basic as i am new to this tool.

      Many thanks in advance.