Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Sort in Pivot ?

Hello dear Friends of QV ,

I need to know how to create a sort by Exoression value in Pivot tabke.

From this table:

Load * Inline [

salesman, qty, amount
Eric, 100, 2000
Paul, 2100, 2000
Slash, 5000, 7520
Fred, 800, 158
];

I build a pivot table..

I need to create a list box with ascending and descending value and cliking in this list box I would to sort by QTY ?

Someone could to help me?

Thanks

Best Regards

🙂

--

Slash

2 Replies
Not applicable
Author

I have attached a sample app using the data you provided.

There is a macro which runs during the OnSelect of the Sort By field. The Sort By field is an inline having Descending or Ascending with One Always selected.

In the macro, we change the SortByExpression property (which controls sort order) depending on which is selected.

I use a variable set to "=GetFieldSelections("Sort By")" to hold the selection in the Sort By box. This could probably be skipped and all handled within the macro, but I think using a variable makes it a little easier to follow.

Not applicable
Author

Thank you,

You used API code ...

Do you think is possible to use sql script?

Best Regards

--

Smile Slash