4 Replies Latest reply on Mar 12, 2018 7:38 AM by Michael Hesser

    "Sum by ..."

    Vincenzo Alfano



      I' m trying to build a sum by a dimmension. I want to sum the returns by day, so that I have a sum for each "day" {1,2,3.....,22).




      Day1 (d1) : sum all returns with Day=1

      Day2 (d2): sum all returns with Day=1 or Day2

      Day3 (d3): sum all returns with Day=1 or Day=2 or Day=3






        • 1. Re: "Sum by ..."
          Michael Hesser

          Hi Vincenzo--


          Will a LOD calculation work for you?



          {FIXED DATEPART('day', [Day]):SUM([return]}


          This should give you the non-running sum of returns for each unique day.


          Once you've plotted the non-running sum per day

          • Right click on the SumByDate pill
          • Select Edit Table Calculation
          • Choose Running Sum.


          Your detail may look like this:


          (before running total)


          (after Running Total)


          Good luck!

          • 2. Re: "Sum by ..."
            Vincenzo Alfano

            What do you think about this solution? May you have a better one...:


            IF (ATTR([day])=1 OR ATTR([day])=  2) THEN RUNNING_SUM(SUM([return])) END

            • 3. Re: "Sum by ..."
              Vincenzo Alfano

              Hi Michael,

              thanks. The function doesn't work. Is it also possible to plot it as a table where you can filter by date?

              • 4. Re: "Sum by ..."
                Michael Hesser

                Hi Vincenzo;


                Could you attach a .twbx please?


                Also, can you describe what type of behavior you want to see when plotting as a table? For example: do you want the user to be able to see the running-sum for a particular day, without the the rest of the detail?

                Do you just want to see it displayed as text, rather than plotted?

                Or do you want the date range to reset based on what the user chooses to view?


                Thanks! --Michael