Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Pivot table sorting

Hi

I'm pretty new in the whole Qlikview-world and therefore I might have an simple question - well not simple to me

I have created a pivot table which sums students ECTS points for each week every year. (See table below)

As it can be seen the week (ugenummer) is sorted in ascending order, which is correct. But because an academic year goes from september to september the year after, I want to show data starting from week39.

So the sorting has to be week 39 to week 52 and thereafter week 00 to week 38.

Anybody who can tell me how to do that?

I'm aware of the sort possibility in the properties menu - but it only allows me to sort in ascending or descending order - and not to cut the data at a certain point?

Thanks in advance for answers!!

Kind Regards

Maria

pivottable2.png

1 Solution

Accepted Solutions
Highlighted
Specialist
Specialist

I think that Ugennummer should have been Ugenummer as well. (Too many "n"s). That field should be exactly the same as the field in your fact table - Sorry

View solution in original post

10 Replies
Highlighted
Specialist
Specialist

Incorporate the year into the sort (as I presume that they are different).

If this is not the case you can create a small reference table that will just have the week numbers and a different sort order. Incorporate that into your application and use the new sort order for your sorting.

Don't forget to use the same field name for ugennummer.

Highlighted
Master III
Master III

What do you mean by "cut the data"?

What sorting you need?

Highlighted
Creator
Creator

I want the pivot table to show week 39 "W39" in the first row and then up to week 52. The row after week 52 should be week 00 - even though I know there aren't any week 00 - (but there is in the data set).

The data is futhermore dynamic and not static - so every week I get another week more in the data set and therefore I should also get another week in the pivot table

Highlighted
Specialist
Specialist

Create the following:

Ugennummer_Sort:

Load * inline

[Ugennummer, Ugennummer_SortOrder

W39,1

W40,2

W41,3

W42,4

W43,5

W44,6

W45,7

W47,8

W48,9

W49,10

W50,11

W51,12

W52,13

W01,14

W02,15

etc to .....

W38,52

];

This table will join automatically to your data and act as a reference to the correct sort order. You then sort the Ugennummer by Ugennummer_Sort .... or Max(Ugennummer_Sort).

Highlighted
Creator II
Creator II

Hai Frd...

Create two Variables

Ex:(For 0 to 38)->Year Of Week

vWeek1

= '>=' & WeekStart(MIn(Date),0) & '<=' &WeekStart(Min(Date),38)

(For 39 to 52)->Year Of Week

vWeek2

= '>=' & WeekStart(MIn(Date),39) & '<=' &WeekStart(Min(Date),52)

This Is Used In Your Expression

Like:... 1)Sum({<DateField={$(vWeek1)} Field Name) Here Returns 0 to 38 Data are Show

           2)Sum({<DateField={$(vWeek2)} Field Name) Here Returns 39 to 52 Data are Show

I Hope u Try This One Very Helpful to U...

Highlighted
Creator
Creator

I have typed the code in the script and reloaded it. Then in proporties of the table, I have chosen the sort tab and activated ugenummer - activated "expression" and typed max(Ugenummer_sortOrder).

But nothing happens?

proporties.png

Highlighted
Specialist
Specialist

Uncheck the Sort by Text box

Highlighted
Specialist
Specialist

I think that Ugennummer should have been Ugenummer as well. (Too many "n"s). That field should be exactly the same as the field in your fact table - Sorry

View solution in original post

Highlighted
Creator
Creator

1.pngnow it is sorting, but in a very starnge way: