Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pivot Table Sum of rows using aggr

hi i have the following scenario. i wish to add the rows together to show result in the totals.

i have a table whereby i wish to exclude the planning price in the calculatio nand then show the value as the total with the planning price as seen below in a pivot table.

my code .

if planning_price <> 0,

aggr(sum(value),maingroup,dept,opt)

this however still returns the total value of 1500.

can anyone perhaps help me with this?

maingroup dept optionNumber    value  planning price

Total                                            500                                -> Desired Result

11              1      500                    500     200

12              2      1000                  1000   0

Best

Brad

3 Replies
MK_QSL
MVP
MVP

Can your provide sample apps or sample data please?

sunny_talwar

You just want the total to include value where planning price <> 0, but the your chart would still have values where planning = 0?? Is my interpretation correct here??

sunny_talwar

Depending on the output you are looking for you can use one of the following expressions:

1st table: =Sum(Aggr(Sum(If([Planning Price] <> 0, Value)),[Main Group], Dept, [Option Number]))

2nd table: =If(Dimensionality() = 0, Sum(Aggr(Sum(If([Planning Price] <> 0, Value)),[Main Group], Dept, [Option Number])), Aggr(Sum(Value), [Main Group], Dept, [Option Number]))

HTH

Best,

Sunny