Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
amanjain57
Creator II
Creator II

Sorting within a dimension in a pivot table.

Hi,

I am trying to use a sorting function but due to the logic its unable to perform.

I will explain through a example.

Suppose I have two dimensions : Product Family and Customer.

Each product family have different customers. Customers in different product families could be the same.

Eg: Product Family : ABC,  XYZ

Customer : Ford , Nissan

Measure : Sum (Revenue)

I create a pivot table which has Primary Sorting for Product Family by Revenue(descending order). The seconday sorting is for Customer again by Revenue(descending order).

Product Family    Customer     Revenue

ABC                      Ford            $ 100

                             Nissan        $ 200

XYZ                      Ford            $200

                             Nissan         $10

Total of ABC =$ 300, XYZ = $210.

So the sorting is Ok.

But what i want is that Ford and Nissan should also rearrange themselves in descending order in their product families.

According to the logic, it sums up the revenue for Ford =$300, Nissan=$210 and that is why Ford always appears above Nissan in product families.

How could we accomplish this task ??

So that in ABC the order is Nissan, then Ford. Xyz has the order Ford then Nissan.

Labels (1)
1 Solution

Accepted Solutions
Carlos_Reyes
Partner - Specialist
Partner - Specialist

As gwassenaar‌ explains in Is it possible to sort measure in pivot table using Qlik Sense?, you need to replace the dimension you want to sort by with a dual function. So... your first dimension will be ProductFamily but the second will be " Dual(Customer, Aggr(Sum(Revenue),ProductFamily,Customer)) ". Then you can sort the second dimension numerically in the sort tab.

Review the enclosed file to see the example.

View solution in original post

10 Replies
Carlos_Reyes
Partner - Specialist
Partner - Specialist

As gwassenaar‌ explains in Is it possible to sort measure in pivot table using Qlik Sense?, you need to replace the dimension you want to sort by with a dual function. So... your first dimension will be ProductFamily but the second will be " Dual(Customer, Aggr(Sum(Revenue),ProductFamily,Customer)) ". Then you can sort the second dimension numerically in the sort tab.

Review the enclosed file to see the example.

shraddha_g
Partner - Master III
Partner - Master III

In Sorting Tab,

Go to Customer - Choose sort by Expression, use Revenue Expression there and apply descending order.

It works.

prat1507
Specialist
Specialist

Hi

PFA the attached .qvw for your reference.

Regards

Pratyush

amanjain57
Creator II
Creator II
Author

Thanks a ton.

It works, but when i try to select something in the filter, the filter shows no value.

Error 1.JPG

It should show me Ford GM etc.

Do you have any suggestions?

amanjain57
Creator II
Creator II
Author

Thanks Pratyush for the reply. Can you send me a qvf file.

This file doesnot runs on my Qlik Sense

amanjain57
Creator II
Creator II
Author

Hi Sharddha,

I tried that and simply sorting it out was not solving the problem.

amanjain57
Creator II
Creator II
Author

Also, when i just try Customer in the expression.

The filter works.

It only doesnot works with the dual expression.

amanjain57
Creator II
Creator II
Author

So, i got a way to run the QVW file in QVF,

But i could not see any sheet or any visualization.

Can you please send me the expression you used?

paolo_mapelli
Creator II
Creator II

It works unless you rearrange dimensions in pivot table (e.g. "Customer" before "Product Family")