Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Theo_Westseit
Contributor III
Contributor III

Sort by greatest deviation

Hello Guys,

I am currently stuck developing an application.
Ive created a table with three columns:

IsPlanDeviation
10070+30
510-5
3070-40
7050+20

 

The Code at Column Deviation looks like this:

 

(Sum({<Year={"$(=max(Year))"}>}Is)
-
Sum({<Year={"$(=max(Year))"}, Version={"000"}>}Plan)

 

 

I would like to sort the Values in Column 3 by greatest Deviation (wherever its + or -)

So the Table should look like this:

IsPlanDeviation
3070-40
1007030
705020
510-5

 

Do you have any ideas? Thanks in advance!

11 Replies
stevejoyce
Specialist II
Specialist II

I meant insert fabs in the Sort by expression, not the actual expression.  But if it's an expression you can't sort by a specific expression.  This should work.  Leave Number format to Auto (not number) and sort numerically Descending

 

dual(num((Sum({<Year={"$(=max(Year))"}>}Is)
-
Sum({<Year={"$(=max(Year))"}, Version={"000"}>}Plan),'#,##0 $;-#,##0 $'),
fabs((Sum({<Year={"$(=max(Year))"}>}Is)
-
Sum({<Year={"$(=max(Year))"}, Version={"000"}>}Plan)
))

Theo_Westseit
Contributor III
Contributor III
Author

Thanks guys! It works perfect now!