Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
mr_novice
Creator II
Creator II

Pivot table with set analysis?

Hello all!

I have a problem that I cant solve and hope you can give me a suggestion how to solve this

I have a pivot table with dimensions Category and YearMonth. Categories are displayed as rows and YearMonth as columns so for each category there are one expression per YearMonth.

Now, the expression is just a sum of TransactionAmount. This works fine. But now I want add one expression that calculates the delta between month's.

My first expression is Sum([Month Result]) and to create a delta between ie 201202 and 201201 I do this but it doesn't work:

sum([Month Result])

-

sum({$<[YearMonthCounter]={"=$(=[YearMonthCounter]-1)"}>}[Month Result])

I use "Yearmonthcounter" to avoid problems when its the first month of the year.

This is what I want to achieve:

Category    201201                201202                 201203       

                 Amount    Delta    Amount    Delta    Amount    Delta   

1               1000         0         500          -500      200         -300

2               200           0        1000         800       100         -900

Any suggestions?

Br

cristian

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

I'm sorry I meant BEFORE, so if Month is a dimension (on the x axis) you have

sum(Month Result) - Before(sum(Month Result))

View solution in original post

4 Replies
alexandros17
Partner - Champion III
Partner - Champion III

use keyword "PREVIOUS"

mr_novice
Creator II
Creator II
Author

Hmm you mean like this?

sum({$<[YearMonthCounter]={"=$(=previous([YearMonthCounter]))"}>}[Month Result])

alexandros17 wrote:

use keyword "PREVIOUS"

alexandros17
Partner - Champion III
Partner - Champion III

I'm sorry I meant BEFORE, so if Month is a dimension (on the x axis) you have

sum(Month Result) - Before(sum(Month Result))

mr_novice
Creator II
Creator II
Author

Great. Thank you!

What about if I want to compare this new expression with the grand total of 'before sum(MonthResult))' like this:

sum(monthResult)-before(sum(monthResult)) / before(sum(TOTAL monthResult))...This does not work...

Br

cristian