Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
juan_c_martinez
Contributor III
Contributor III

Conditional sum in a pivot table

I want to sum the highest level values (in grey) in the pivot table table:

coditional_sum.jpg

I have tried several strategies with set analysis,, aggr event with if.... none has worked.. (see qvw attached)

Any suggestion?

Thanks in advance....!!!

Juan C.

2 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Arrive a flag in script like this

Data:

LOAD Dim1,

     Dim2,

     Month1,

     Level,

     Value

FROM

Sun_Max.xlsx

(ooxml, embedded labels, header is 1 lines, table is Hoja3);

LEFT JOIN

LOAD

Dim1,

  Dim2,

  Month1,

Max(Level) AS Level,

1 AS Flag

RESIDENT Data

GROUP BY Dim1,

  Dim2,

  Month1;

Now use this expression to get only max Level values

=Sum({<Flag={1}>} Value)

Regards,

Jagan.

juan_c_martinez
Contributor III
Contributor III
Author

Jagan,

Thanks for your time!!!

This solution works fine in case of the Dim1 and DIm2 were fixed. But the solution I look for should work for any combination of dimensions (in the real scenery are 5 dimensions and the user always wants to see by any combination of dimension the sum of the cases with highest level of priority ).

The solution should came using set analysis in combination with the dolar-sign expansion but unfortunately the function inside the dolar-sign is evaluated outside the pivot table and then it doesn't take in account the level according to the combination of dimensions existing in the cell.

dolar.jpg

Again thanks,

Juan