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

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

1 Solution

Accepted Solutions
sunny_talwar

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

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

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

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

It depends on the Something.


talk is cheap, supply exceeds demand
sunny_talwar

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

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))