Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating a Total Column


Hi

I have a sample of a straight table. (see below).  Sales per item per Branch.

I want to create a total column per item ( ie i want to create the column highlighted in yellow).

How do I do this.

kind regards

Nayan

ITEM  CODEBranch NameSalesTotal Sales per Item
ABCBloemfontein2832,145
ABCBotswana312,145
ABCCape Town2682,145
ABCDurban1552,145
ABCEast London812,145
ABCJohannesburg2282,145
ABCNamibia3202,145
ABCNelspruit4002,145
ABCPolokwane802,145
ABCPort Elizabeth1892,145
ABCSwaziland02,145
ABCUpington1102,145
ABCTotal2,1452,145
DEFBloemfontein971,529
DEFBotswana31,529
DEFCape Town1381,529
DEFDurban1581,529
DEFEast London791,529
DEFJohannesburg6141,529
DEFNamibia1091,529
DEFNelspruit771,529
DEFPolokwane151,529
DEFPort Elizabeth851,529
DEFSwaziland1521,529
DEFUpington21,529
DEFTotal1,5291,529
3,6741,529
17 Replies
Not applicable
Author

Hi Anbu

Attached herewith is the Sample Qlikview Model and an excel spreadhseet on which the Qlikview model is based on.

The Excel spreadheet has a sheet which contains sales per item per month per branch.

I have added a new field called "MonthIndex" .  This is use so that it will enable me to calculate sales for the last few months.

The chart table I created shows sales for the last 6 months and shows the "Average Last 6 Months".

In this sample model, i want the TOTAL for the "Average Last 6 Months".

So, Total for ABC = 11,025 ,  DEF =686 and GHI = 8429

Thanking you in advance.

kind regards

Nayan

anbu1984
Master III
Master III

How did you get Total for ABC = 11,025 ,  DEF =686 and GHI = 8429?

Can you post qvw which you tried to get avg of last 6 months?

Not applicable
Author

Hi Anbu

When i looked at my post, i see the QV Model did not attached.  Please find attached QV Model.

kind regards

Nayan

anbu1984
Master III
Master III

(SUM(TOTAL<[Item Code]> {<[MonthIndex]={'$(vMaxMIMinus6)'}>}[Sales Quantity])

+

SUM(TOTAL<[Item Code]> {<[MonthIndex]={'$(vMaxMIMinus5)'}>}[Sales Quantity])

+

SUM(TOTAL<[Item Code]> {<[MonthIndex]={'$(vMaxMIMinus4)'}>}[Sales Quantity])

+

SUM(TOTAL<[Item Code]> {<[MonthIndex]={'$(vMaxMIMinus3)'}>}[Sales Quantity])

+

SUM(TOTAL<[Item Code]> {<[MonthIndex]={'$(vMaxMIMinus2)'}>}[Sales Quantity])

+

SUM(TOTAL<[Item Code]> {<[MonthIndex]={'$(vMaxMIMinus1)'}>}[Sales Quantity]))/ 6

Or

Aggr(SUM( {<[MonthIndex]={'$(vMaxMIMinus6)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus5)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus4)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus3)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus2)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus1)'}>}[Sales Quantity]),[Item Code])/ 6

Not applicable
Author

Hi Anbu

Thank you .  Much appreciated.  The first formula worked perfectly.

The second formula gave a total but for only 1 line.  Do you know why it does.

See attached.

Again, thank you for all your help.

kind regards

Nayan

its_anandrjs

Sure check and let me know.

Regards

Anand

anbu1984
Master III
Master III

If(IsNull(Aggr(SUM( {<[MonthIndex]={'$(vMaxMIMinus6)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus5)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus4)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus3)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus2)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus1)'}>}[Sales Quantity]),[Item Code])/ 6

),Above(Column(9),1,1),Aggr(SUM( {<[MonthIndex]={'$(vMaxMIMinus6)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus5)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus4)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus3)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus2)'}>}[Sales Quantity])

+

SUM( {<[MonthIndex]={'$(vMaxMIMinus1)'}>}[Sales Quantity]),[Item Code])/ 6

)

Not applicable
Author

Hi Anbu

Thank you for all your help.  This is very useful for me.  Sorry for the delayed reply as it was the weekend and got to work this morning.

kind regards

Nayan