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: 
Arpit
Contributor
Contributor

How to do multiple totals in a Pivot table?

Hi Guys,

I am trying to do multiple subtotals in a Pivot table , Any help would be much appreciated.

What I need is as given below:

 

Type(Row)MarApr
A1015
B1020
A+B2035
C1025
D1010
Total4070

 

Please let me know if this is even possible with table properties or any other solution.

Thanks In Advance 

Arpit

 

1 Reply
Qliker35
Contributor II
Contributor II

Hi,

First A+B needed to be define as a type dimension. in the SQL script. 

To do that union all can be used.

First select statement for the table values. Second select statement is for the additional A+B values. 

Ex: 

In loader script or in the sql side.  

Type:

LOAD
Type,APR,MAY;

SQL
SELECT Type , APR, MAY
FROM dbo.TypeVal

UNION ALL

SELECT 'A+B' AS Type , sum(APR) as APR , sum(MAY) as MAY
FROM dbo.TypeVal WHERE Type in ('A','B'); 

 

After that, values can be sort by dimension in the editor side manually. 

if(Type='A',1,

if(Type='B',2,

if(Type='A+B',3,

if(Type='C',4,

...

))))