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

Subtotal instead of Total

Hi experts

I need to calculate the subtotal of the following example:

TomBond77_0-1622978721365.png

Currently I have the logic for Total but I need to subtotal:

Sum({<Year={'2021'}, [Goods Receipt]={'X'}>} TOTAL <[Vendor Key]> [Sales])

Any ideas?

Thank you, Tom.

3 Replies
TomBond77
Creator III
Creator III
Author

Thank you 

I don't need a running total, I need a subtotal on (distinct) vendor. But I tried your proposals, it is not giving any results:

Aggr(RangeSum(Above(TOTAL Sum([Sales]), 0,RowNo())), <[Vendor Key]>)

Any further ideas?

Many thanks

Tom

Or
MVP
MVP

I think your formula for the total by vendor is already correct, though that one would repeat for each line rather than showing up once. You might be able to use Below() to only show it once, but this may cause erratic behavior if you also have suppress 0 / null enabled due to the way Qlik handles the combination thereof. It'd look something like:

If(Only(Vendor) <> Below(Only(Vendor)),Sum({<Year={'2021'}, [Goods Receipt]={'X'}>} TOTAL <[Vendor Key]> [Sales]))