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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sub total pivot table

Hi everyone,

I am a beginner. I would like to get something like this :

Dim 1    DIm2   Exp1     Exp2

A          j            2             14

A         d             5            14

A         e             7            14

B         t              1             5

B         r              4            5

I don't know how to get the Exp2. I would like to do a sum without taking into account the second dimension.

I tried an expression like  sum ({<Dim2=>} value)  but this doesnt work.

thank you for your help

1 Solution

Accepted Solutions
Nicole-Smith

sum(TOTAL <Dim1> value)

View solution in original post

5 Replies
Nicole-Smith

sum(TOTAL <Dim1> value)

alexandros17
Partner - Champion III
Partner - Champion III

Try this

sum(aggr(sum(value), Dim1))

MK_QSL
MVP
MVP

Script side...

Data:

Load * Inline

[

  Dim1, Dim2, Exp1   

  A,     j,      2  

  A,     d,      5

  A,     e,      7

  B,     t,      1

  B,     r,      4

];

Left Join (Data)

Load

  Dim1,

  SUM(Exp1) as Exp2

Resident Data

Group By Dim1;

=====================

You expression Exp1 could be Sum(Sales)

Not applicable
Author

Thank you Nicole, it works well.

Now, I would like to have a 3rd expression which is exp1/exp2 (so the percentage).  I did the expression exp1 / the expression exp 2 and it works but I'm just wondering if there was another way to do it (a shorter or simpler way) ?

Thanks again.

MK_QSL
MVP
MVP

Column(1)/Column(2)