6 Replies Latest reply on Dec 4, 2015 12:51 PM by Bin Xiao

    How to get the data by max date and then sum it up?

    Bin Xiao

      Dear all,

       

      I am struggling on the following calculations: (I am using Tableau 9.0 version and using Live data)

       

      Item NumberDateEnd QuantityCost
      ABC-19/3/1510010
      ABC-19/25/158010
      CDE-310/9/1512020
      CDE-311/3/1518018

       

       

      So, what I want to achieve is:

       

      (1) Get the "End Quantity" and "Cost" for each item by max (most recent) date:

       

      In this case, for item ABC-1: since the max date is 9/25/15, the end quantity I want to use is 80 and cost I want to us is 10

       

      for item CDE-3, since the max date is 11/3/15, then end quantity I want to use is 180 and cost I want to us is 18;

       

      (2) Then calculate the total cost:

       

      Total cost of item ABC-1 + Total cost of item CDE = 80*10 + 180*18  = 4040

       

      (3) In Tableau, I want to show that 4040 as a single field (that means, in my dashboard, it will have a "Total Cost" field which shows 4040)...

       

      Thank you very very much for your help!!!