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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Total sum for each row in pivot table.

Hi all,

I'm struggling in getting the total row by row.

We have value for each month and also value for the total, loaded in script.

total.png

Is there a way to loop in the front end through each row and get the total.

Currently I'm getting the total sum of all values in the table. I would need to get the total for each line.

if((month='Total'),

sum(TOTAL aggr((sum({<month=-{'Total'}>}nt)/sum({<month=-{'Total'}>}numva)),month,identifier))

,sum({<month=-{'Total'}>}nt)/sum({<month=-{'Total'}>}numva))

Thanks to anybody that can help

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Try this

If(SecondaryDimensionality() > 0,Sum(Value),
RangeSum(First(Sum(Value),1,NoOfColumns
())))

and set Partial TOTAL in Month

View solution in original post

5 Replies
Anil_Babu_Samineni

You mean this?

If(month = 'Total', 'TOTAL' & Expression, Expression1)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

IDTotalJanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
555828.771.372.742.744.110.002.740.002.744.115.480.002.74
5559.38.301.422.843.554.262.132.132.133.557.093.552.133.55
556037.504.174.178.335.564.172.780.000.004.171.391.39

1.39

Sorry, my mistake.

Total has to be as in the previous table.

Now it's being calculated as:

sum(TOTAL aggr((sum(nt)/sum(numva)),month,identifier))

With this I would get:

The sum of: 28.77+38.30+37.50

IDTotalJanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
5558104.561.372.742.744.110.002.740.002.744.115.480.002.74
5559.104.561.422.843.554.262.132.132.133.557.093.552.133.55
5560104.564.174.178.335.564.172.780.000.004.171.391.39

1.39

Hope it's more clear now loveisfail

antoniotiman
Master III
Master III

Try this

If(SecondaryDimensionality() > 0,Sum(Value),
RangeSum(First(Sum(Value),1,NoOfColumns
())))

and set Partial TOTAL in Month

Anonymous
Not applicable
Author

Thanks, but no luck

Only get the avg for each one

If(SecondaryDimensionality() > 0,(sum(nt)/sum(numva)),

RangeSum(First((sum(nt)/sum(numva)),1,NoOfColumns())))

list.PNG

Anonymous
Not applicable
Author

Antonio,

I was working on your response and finally got what I needed based on your query.

if(month='Total'

,RangeSum(First(sum({<month=-{'Total'}>}nt)/sum({<month=-{'Total'}>}numva),1,NoOfColumns()))

,sum({<month=-{'Total'}>}nt)/sum({<month=-{'Total'}>}numva))

Thanks!!!