10 Replies Latest reply on Sep 30, 2016 11:54 PM by Stergios Hetelekides

    Taking Running Total and Calculating Differences

    Stergios Hetelekides

      Hi,

       

      I am new to Tableau. I have some data that contains a running total of some data. I am trying to create a bar chart that graphs the difference from one row to the next. I thought creating a calculated field would do the trick, but I cannot figure out the correct calculation to achieve this. Below is an example of what I'm looking for.

       

      Running Total of Some DataCalculated Field (Difference)
      1.01.0
      1.20.2
      1.80.6
      2.70.9
      2.90.2
      3.80.9
      4.50.7
      5.10.6
      5.10.0

       

      I've tried many different calculations and I cannot get it to work. The one that I believe should do the trick is:

      [Running Total of Some Data]-PREVIOUS_VALUE(0)
      

       

      But I get the error, "all fields must be aggregate or constant when using Table Calculations or fields from multiple data sources." I'm sure this is not how PREVIOUS_VALUE works. I'm probably misunderstanding something crucial. Maybe my field's description will help?

       

      Running Total of Some Data

      Role:

      Continuous Measure

      Type:

      Database column

      Remote column:

      [table].[running_total]

      Remote type:

      Double-precision floating-point number

      Default aggregation:

      Sum

      Status:

      Valid

       

      If you know of any other efficient way of producing my desired result (bar graph with difference), please let me know! Performance matters.

       

      Thank you for any help!