Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

vvvvvvizard
Contributor III

Sort by expression

I have a pivot table with two dimensions Region and Department and two expressions Sum(Actual) and Sum(Budget)

For the region i have them sorted by expression as region 1 , 2 , 3, admin ect

Now how do i sort the department within each region . I want to sort them by the smallest difference between expression 1 and two first

                                       actual  budget

eg region  1  depart10  100 99

                      depart 8    50 84

                      depart 3    2    100

   region 2       depart 5   80 100

                        depart 2  10  90

so the department with smallest difference between actual and budget must be first for each region .

Please assist

1 Solution

Accepted Solutions
hhajjali
New Contributor III

Re: Sort by expression

Hello,

In sort parameters first put region, then department, then actual, then budget.

In department sort, set by expression, and in the expression :

[Budget]-[Actual].

Hope it help.

2 Replies
hhajjali
New Contributor III

Re: Sort by expression

Hello,

In sort parameters first put region, then department, then actual, then budget.

In department sort, set by expression, and in the expression :

[Budget]-[Actual].

Hope it help.

MVP
MVP

Re: Sort by expression

Switch the sort for department to Expression (ascending) , and enter the difference expression - something like

=Sum(..... Actual) - Sum(..... Budget)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein