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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subtract upper row in a pivot table

Hi guys!

I'm new in this community and I hope to find a solution to my issue.

I have a pivot table like this

MonthABX
11000
2528
32014

where only Month is a dimension and A and X are expressions.

I want to evaluate X in this mode X(Month) = A(Month - 1) - B(Month).

Can someone explain me how to do that?

10 Replies
tresesco
MVP
MVP

Try:

=Above(A)-B

A,B could be labels or expressions.

vipin_mishra479
Creator II
Creator II

hi

use above function like tresco has define.

=Above(A)-B

Not applicable
Author

Hi tresesco,

I'm sorry but it doesn't work. It returns '-' as result.

tresesco
MVP
MVP

See attached qvw

Not applicable
Author

Your example is perfect but I don't understand why it doesn't work for my chart.

See the attached screenshot (the formula is at the 6th line).Capture.PNG.png

The expression is related to the column "Storno totale".

tresesco
MVP
MVP

Sum ( If( Sum ......... structure is wrong. To use one aggregation function into another, you have to use Aggr(), like:

=Aggr( Sum( If(Sum....)), Dim1, Dim2...)

SunilChauhan
Champion II
Champion II

sum(above(A))-Sum(B)

Sunil Chauhan
Not applicable
Author

Use Above(A)-B

Not applicable
Author

Can you send some sample.qvw