2 Replies Latest reply on Mar 22, 2017 2:55 AM by Esther Twain

    Cumulative # of products for different dates

    Esther Twain



      Can someone give me some general tips about solving this challenge? I am completely clueless!

      I'm trying to come up with the LOD expressions to give the both cumulative # of products, but I am struggling.... Is it the Order ID we want to count or the Product Name?...


      Any help will be appreciated.


      Tableau 10.2. Superstore sample


      comparison of cumulative numbers.PNG






        • 1. Re: Cumulative # of products for different dates
          Karthik Venkatachalam

          Hi Esther,

          The description seems ambiguous. The person that wrote this, does not recognize the fact, "# of products ordered", could really mean any...

          1) Either the COUNTD(product_name)

          2) COUNT(Product_name) or COUNTD(Order_ID)

          If I were to guess, without asking for any clarification, I would go with option 2.


          With regards to Dates, When you are dealing with 2 dates, you are dealing with 2 different dimensions. Recommended way is to have a bridging dimension/ Date Field that you can use. If that is not an option you can just drag both Ship and Order dates and synchronize the axis. Here is my attempt at displaying both. Highlighted yellow, is parts where we see there are Dates with Orders, more frequently than Dates with Shipments. (Probably, they were receiving orders over weekends as well. But they were shipping those only on weekdays).


          Finally, the CNTD(ORDER ID) field has a running total table calculation in it, which is same as cumulative products ordered. (If you feel, a order can have multiple products in them, then feel free to use CNTD(Product Name) field instead.


          Attaching the workbook as well.



          Please remember to mark the thread answered, if its helpful.


          Thank you.

          1 of 1 people found this helpful
          • 2. Re: Cumulative # of products for different dates
            Esther Twain

            Hello Karthik, and thank you so much for the explanation

            Actually, the solution I have contemplates that bridge table you are talking about, so thanks for showing the other approach.


            Now, with this approach of having the 2 dates on the view, how can we calculate the balance of shipments? Is it even possible? (RUNNING_SUM( COUNT([Order date order IDs]) ) - RUNNING_SUM(COUNT([Ship Date order IDs ] with the bridge table).


            Thanks again!