Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
alif
Contributor
Contributor

Total column in Script

Hello, I'm new to Qlikview so this might be easy.

I have a set of data the includes several KPIs for several companies per month. Below is a simplified example showing 3 KPIs for 2 companies in 2 months.

Capture.PNG

I want to add a 'Total' column to show the total value of a KPI for all companies in a certain month.

For example: in April both companies had a revenue of 1; so the total column should equal 2 for all rows that have:

  • Month = April
  • KPI = Revenue

Similarly, the total column would equal:

  • 8 for Revenue rows in May
  • 4 for Units rows in April

Capture1.PNG

 

I used the method described in this thread https://community.qlik.com/t5/New-to-QlikView/Load-Script-Add-a-total-column/m-p/503083 but that just gave me a total of all KPI for all companies in all months.

 

Any help is appreciated. Thanks in advance.

Labels (2)
1 Solution

Accepted Solutions
anushree1
Specialist II
Specialist II

Please check the attached

View solution in original post

7 Replies
Shubham_Deshmukh
Specialist
Specialist

can u share this sample small data
alif
Contributor
Contributor
Author

 
Shubham_Deshmukh
Specialist
Specialist

I cannot open qvw here, share sample data of your your snapshot
alif
Contributor
Contributor
Author

Thank you for replying. I've attached an excel sheet with the sample data and below is a simplification of my script

Table1:
LOAD Month,
Company,
KPI,
Data

FROM
Sample.xlsx
(ooxml, embedded labels);

Join (Table1)
Load
sum(Data)
Resident Table1

anushree1
Specialist II
Specialist II

Please check the attached

sunny_talwar

Try this

Table1:
LOAD Month, 
     Company, 
     KPI, 
     Data
FROM Sample.xlsx
(ooxml, embedded labels);

Join (Table1)
LOAD Month,
	 KPI,
	 Sum(Data) as Total
Resident Table1
Group By Month, KPI;

or try this in the front end as an expression

Sum(TOTAL <Month, KPI> Data)
alif
Contributor
Contributor
Author

Thank you all.