Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Make a Sum of an Expression

I have the following expression:

=FirstSortedValue(PartStockEnd, -Date)

It gives me the following results: (with PartStockEnd as a value, which is the stock at the end of that month)


Month Article 1Article 2Article 3Article 4Article 5
jan 21 33 12 63 36
feb 14 27 35 51 32
mrt 12 25 70 0 20
apr 77 0 28 38 45
may0 0 114 35 60
jun 70 20 111 34 38


Which is correct. I can display this and a chart and everything is fine.

But now I want to have a sum of the stock for each month, so I can see the total stock over the last months. How can I accomplish this?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You are using a pivot table with two dimension Month and Article, right?

Try

=sum(aggr( FirstSortedValue( PartStockEnd, -Date) , Month, Article))

and enable appropriate partial sum for your dimension in presentation tab.

View solution in original post

2 Replies
swuehl
MVP
MVP

You are using a pivot table with two dimension Month and Article, right?

Try

=sum(aggr( FirstSortedValue( PartStockEnd, -Date) , Month, Article))

and enable appropriate partial sum for your dimension in presentation tab.

Not applicable
Author

Thanks mate! This worked for me!

Can you please explain what this aggr() in combination with those 3 values does? Cause i know it works, but I dont know how