3 Replies Latest reply: Dec 4, 2017 7:53 AM by Sunny Talwar RSS

    Cumulative sum based on two dimensions (Qlik Sense)

    Gonzalo Yagüe Suñol

      Hi all,

       

      On the one hand, I have bar chart representing the sum of Sales (measure) per country (dimension). On the other hand, I have a filter with the number of weeks (from 1 to 52, all of them as integers...).

       

      This is a long exercise. The first step would be to display the sum of sales, considering only the data related from number one to the maximum week selected. In other words, if the maximum week selected was 5, it should display the sum of sales for each country from first to fifth week.

       

      I know there are some threads about this topic but I have not been able to achieve it. Here we can see some of the codes I have used:

       

      * Sum({$ <Week = {<=$(=Max(Week))}>}[Sales])

      * Sum({$ <Week = {'<=$(=Max(Week))'}>}[Sales])

      * Sum({$ <Week = {"<=$(=Max(Week))"}>}[Sales])


      I have read on several threads about the importance of single and double quotes. Unfortunately, if I use them, Max and Week are not colored as function and field respectively and obviously it does not work. If I don't use them, Max and Week are colored well but it does not work.


      I would really thank you if anyone can help me. It should be very easy but I am stuck.


      Best regards,


      Gonzalo