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

Sorting in a pivot table

Hi, I need help in qlikview document to sort data in a PivotTable
I have pivot table with Item as dimension and two expression: first is the sum of value for year 2017 and second is sum of value for year 2016

 

ITEMVALUEYEAR2017VALUEYEAR2016
Q600,266558808
Q500,30819209
Q400,339399076
Q100,46405547
QQQ00,508628659
VVV00,640647149
GGG1,0552799181,129666153
FFF1,2895582951,212542373
PPPP01,316492039
EEE2,0345648792,793871192
CCC3,0927833032,967093559
DDD2,2663379563,058289676
HHH03,189853571
BBB9,7724780339,902400863
AAA37,3392419350,40652062

I need to sort data first for the sum of value for year 2017 in descending order and then, when values of this expression is <= to zero, to sorting in descending order for the second expression value(VALUEYEAR2016)

I need to get to the following result

   

ITEMVALUEYEAR2017VALUEYEAR2016
AAA37,3392419350,40652062
BBB9,7724780339,902400863
CCC3,0927833032,967093559
DDD2,2663379563,058289676
EEE2,0345648792,793871192
FFF1,2895582951,212542373
GGG1,0552799181,129666153
HHH03,189853571
PPPP01,316492039
VVV00,640647149
QQQ00,508628659
Q100,46405547
Q400,339399076
Q500,30819209
Q600,266558808

Can someone help me?

thanks

1 Solution

Accepted Solutions
adamdavi3s
Master
Master

Ok a compound formula will do it.

Sort your dimension by expression descending and use this:

=sum(VALUEYEAR2017)*(max({1}VALUEYEAR2017)*1000) + sum(VALUEYEAR2016)

Capture.PNG

View solution in original post

5 Replies
Anonymous
Not applicable

Hi,

In the Sort tab, promote the Sales 2017 first, then Sales 2016 second.

For both, sort them Numeric Value Descending.

I have an app to show you.

Best regards,

Cosmina

adamdavi3s
Master
Master

Sorting in pivots is a pain, Cosmina is right in that you probably want to use a straight table for this!

adamdavi3s
Master
Master

Ok a compound formula will do it.

Sort your dimension by expression descending and use this:

=sum(VALUEYEAR2017)*(max({1}VALUEYEAR2017)*1000) + sum(VALUEYEAR2016)

Capture.PNG

paolojolly
Creator
Creator
Author

Thank you all for the help

adamdavi3s
Master
Master

Did this work out for you?

If so please remember to mark this as helpful or the correct answer if I have helped you or answered your question.

This will help users identify the answers should they come across this thread in the future.