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

Sort by expression in pivot table

Hi,

I have a pivot table with 3 dimensions and 1 expression (sum of amount) and I want to sort this table by this expression, so I can see the largest amounts first.

I try to add this expression in Sort / Sort by expression field for dimensions, but it's not working.

BR, Andris

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

You could consider creating a table in the script part which contains the values you try to achieve with the expressions ... this way you can show the data in a table and you can sort on the data as you wish ...

View solution in original post

8 Replies
Not applicable
Author

A pivot table is by definition sorted by dimensions (first, second, ..)

Use table-style instead.

Not applicable
Author

In table I cannot show sum of amount for used dimensions.

Anonymous
Not applicable
Author

You could consider creating a table in the script part which contains the values you try to achieve with the expressions ... this way you can show the data in a table and you can sort on the data as you wish ...

Not applicable
Author

Well, this can be used as a workaround for this problem and looks like I don't have a choice

Thanks a lot.

Not applicable
Author

Can you expand on this? I'm not sure what you mean by 'creating a table in the script.'

I have the same issue as the poster where I want to sort an expression and only show the top 10.

Not applicable
Author

I had the same problem and that is what I found.

A Pivot table can be sort by an expression but only for the 1st expression. So if you need to sort by some other expression but the 1st I'd recommend a workaround which is create your 1st expression as your sort expression but set the width to be the smallest and the font color to be the same as the background, so the users will not see that. Then in the expression where you want to actually see that formula, simply say =column(1).

That works but I agree it is a workaround, not a solution that we can be proud of.

Not applicable
Author

I solved the issue by just changing from a pivot table to a straight table. I didn't really need to pivot anyway so this was a good solution.

Not applicable
Author

Sorry this is terrible... a major flaw, not to be able to sort any dimension of a pivot table by an expression...

Igor your work around is fantastic - thank you