Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use A Column Header value -1 in set analysis

hello,

i have a report where im using Week as dimension.

I need to add an expression where i have to make the sum of sales where Week = Week-1.

I have the week as dimension and i need to calculate 2 expressions depending on the week dimension.

I'm using sum({$<Week={$(=Week)}>}Sales) btu it's not working when i use sum({$<Week={$(=Week-1)}>}Sales) to get the sum of previous week.

so i'm trying to use the column header of the week -1.

to be more clear

WeekSUM of This WeekSum of Previous Week
2Sum of Week 2Sum of Week 1
3Sum of Week 3Sum of Week 2
4Sum of Week 4Sum of Week 3


Anyone can help???

6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   I am still not clear about the problem.

   You said you want expression which will give you sum only when week = week -1.

   Can you tell us in detail with how you are getting week.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Week is a dimension used in the pivot

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Thats fine.. can you please describe in detail? Like  what you have and what you are trying to achieve.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

I have Week as dimension,

I Added ana expressions Sum of sales for each week,

I still need to add a new expression where I also have to calculate the sales but for The previous Week of the dimension

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Ok,

     Let me explain what you want to do.

  

     Say you have data like this.

     Week   Sales

       2         100

       3         200
       4         300

       5         400

     And you want the chart to look like this.

      Week    Sales1     Sales 2

       2           100             -

       3           200            100

       4           300            200

       5           400            300

      If yes then try this.

      Create a straight chart with dimension as week.

 

      First Expression as sum(Sales)

      Second Expression as Above(sum(Sales))

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
its_anandrjs
Champion III
Champion III

Hi,

See the attached sample file how you find the values of two expression and values of previous week

1. =sum(Sales)

2. =Above(sum(Sales))

As kaushik say about that.

Regards,

Anand