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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of Rows in Text Box

Hi ,

Is there anyway to replicate the Sum of Rows in a Straight chart into a Text Box.

The problem I am facing is,the Total of an Expression is different when you individually calculate the expression for each quarter.

Any help would be greatly appreciated

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

I don't know if this is a copy paste error, but you are missing a parenthesis here:

Sum(Aggr(

              (Sum({<Scenario={'Actual'}>}Clms_Vol) *

              Sum({<Scenario-={'Actual'}>}Unit) *

              Sum({<Scenario-={'Actual'}>}UnitPrice)),

      Quarter))

View solution in original post

13 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can use the aggr function: sum(aggr(sum(Something),Dimension1, Dimension2, ...etc)


talk is cheap, supply exceeds demand
maxgro
MVP
MVP

try

=sum(aggr(sum(unitPerItem*[Unit Price] *[Rejected Items]), Date))

1.png

sunny_talwar
MVP
MVP

Gysbert - Isn't that the same thing as Sum(Something) unless you have a distinct -> Sum(Aggr(Sum(DISTINCT Something), Dimension1, Dimension2, ...etc)

Not applicable
Author

I tried that,its not working in my case,wit the above example following expression is used in the text box.

=(sum(aggr(sum({<Test-={'Actual'},BrandId=p(DealId)>}CostPerBundle),Quarter,Id))/

sum(aggr(sum({<Test-={'Actual'},BrandId=p(DealId)>}TotaUnits),Quarter,Id)))

*sum(aggr(sum({<Test={'Actual'},BrandId=p(DealId)>}Rejected Items),Quarter,Id))*

sum(aggr(avg({<Test={'Actual'},BrandId=p(DealId)>}unitPerItem),Quarter,Id))

sunny_talwar
MVP
MVP

Give this a try:

=Sum(Aggr(

((Sum({<Test-={'Actual'}, BrandId=p(DealId)>} CostPerBundle)/Sum({<Test-={'Actual'}, BrandId=p(DealId)>} TotaUnits)) * Sum({<Test={'Actual'}, BrandId=p(DealId)>} Rejected Items) * Avg({<Test={'Actual'}, BrandId=p(DealId)>} unitPerItem)),

Quarter,Id))

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

It depends on the Something.


talk is cheap, supply exceeds demand
sunny_talwar
MVP
MVP

So you mean if it is field or a bunch of calculations (like in his case a division and multiplication)?

Not applicable
Author

Thanks Maxgro.....it worked well when I am just using the tree fields,but when I use the Set Analysis condition for all the three fields its not working.

Any help

sunny_talwar
MVP
MVP

Did you try this John?

=Sum(Aggr(

((Sum({<Test-={'Actual'}, BrandId=p(DealId)>} CostPerBundle)/Sum({<Test-={'Actual'}, BrandId=p(DealId)>} TotaUnits)) * Sum({<Test={'Actual'}, BrandId=p(DealId)>} Rejected Items) * Avg({<Test={'Actual'}, BrandId=p(DealId)>} unitPerItem)),

Quarter,Id))