Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Sorting issue

Hi Friends

I have attached my Qv doc where I have created a pivot table showing data relating to Insurance Policies with Premium and claims paid. I want this pivot table to sort where row showing premium should come as 1st  row whereas in my pivot table it is  last row.  Kindly help . My required output table is shown below.

Screenshot_1.png

 

 

 

5 Replies
upaliwije
Creator II
Creator II
Author

Can someone  pls help me with a solution

jonathandienst
Partner - Champion III
Partner - Champion III

In a pivot table, the sort order is fixed to the dimension order.  The null date will always sort to the bottom of LOSS_DATE, so we need to fix that with a calculated dimension that returns a value that will sort to the top. I used a dual to prevent this bogus value displaying:

=If(Len(LOSS_DATE) = 0, Dual('', MakeDate(1)), Date(LOSS_DATE))

This can then be sorted in ascending order. See the attached qvw file.

Capture.PNGCapture2.PNG

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

The calculated dimension could be simpler. This also works:

=If(Len(LOSS_DATE) = 0, Dual('', 0), Date(LOSS_DATE))

or even simpler:
=Alt(Date(LOSS_DATE), Dual('', 0))
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
upaliwije
Creator II
Creator II
Author

Thanks Jonthy,

When I reload your attachment I get the  following output.Screenshot_1.png

Please look into this and help me.

upaliwije
Creator II
Creator II
Author

Dear Jonty,

 

Could you help me please