Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On Demand Webinar: See Why Thousands of QlikView Users Have Switched to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner
Partner

sorting Pivot based on period

Hi all,

I have a problem where i need to sort a pivot table based on the dimension (pivoted) but based on a time selection. 

i.e

The user has the following time selectiomns that they can choose from:

Selected Period

YTD

YTG

Fiscal Year

QTR

Last 13 Periods

Next 13 Periods

the Period field is pivoted along the top and the expressions are pivoted down the left side. 

The sorting of the Periods work for all time selections apart from the last 2 in the list above. 

e.g.

If period 9 is selected and the user  selected YTG (Year to Go) then the sorting of the Periods are :

09

10

11

12

13

which is correct

but if the user selected Period 9 and 'Next 13 Periods', i want the sorting to be:

09

10

11

12

13

01

02

03

04

05

06

07

08

obviously from period 01 onwards would be the next year. 

And if they selected Period 9 and Prev 13 Periods, it should be sorted

09

08

07

06

05

etc

Can anyone help please?

I have attached a sample. 

2 Replies
hopkinsc
Partner
Partner

Can anyone help with this please? 🙂

@sunny_talwar @Gysbert_Wassenaar  @jagan @rwunderlich @swuehl 

rwunderlich
MVP & Luminary
MVP & Luminary

In general you can sort on a mid-point (split) using a sort expression like this:

if(Period<split, Period + 100, Period)

-Rob