Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

dynamic sorting pivot table by 2 or more dimensions

hi,

I am trying to sort my pivot table dynamicly and it works perfect when i have only one dimension. But when I have 2 its only beeing sorted by the first dimensin and the second one is being ignored.

so what I have is:

branch     season     profit

    701      20121          80

    701      20111          150

sum                         230

     705     20121         190

     705     20112          100

sum                         290

and what I want is:

branch     season     profit

    701      20121          80

    701      20111          150

sum                         230

     705     20112         100

     705     20121        190

sum                         290

what happend is that no it sorted by branch and season. how can i do this in a macro.

my macro looks like this:

if sn.GetContent.String = "Aufsteigend" then

        for i=0 to dims.Count - 1

            p.Dimensions(i).SortCriteria.Expression.v = sf.GetContent.String

            p.Dimensions(i).SortCriteria.SortbyExpression = 1

            chart.SetProperties p

            sn.SetContent "Absteigend", true

        next

    else

        for i=0 to dims.Count - 1

            p.Dimensions(i).SortCriteria.Expression.v = sf.GetContent.String

            p.Dimensions(i).SortCriteria.SortbyExpression = -1

            chart.SetProperties p

            sn.SetContent "Aufsteigend", true

        next

    end if

it would be great if anyone can help me.

regards

0 Replies