Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
wdchristensen
Specialist
Specialist

Sort By Expression not working as expected in Qlik Sense

I created a pivot table with columns with the days of the week, using the WeekDay() function which returns a dual. I want to show the days as text and sort the columns (Left to Right by the numeric value). For some reason when I try to use the sort by expression option and enter in the num(weekday(WORKED_DATE, 6)) it won’t change the sort order. I have attached a screenshot with green around the desired sort order. Any advise that can help me figure out what I am missing would be greatly appreciated! Thanks

4 Replies
YoussefBelloum
Champion
Champion

Hi,

if it is dual, on it's sorting properties, check sorting on numerical values

wdchristensen
Specialist
Specialist
Author

Hi Youssef,

Thanks for the response. Unfortunately it doesn't have an effect. I also tried to multiply the result by 1 to force a numeric result. No luck...

YoussefBelloum
Champion
Champion

try this:

Dual(Weekday() ,num(WeekDay())

wdchristensen
Specialist
Specialist
Author

So I figured out the issue. I was using

=TEXT(WeekDay(WORKED_DATE, 6))

for the column when I should have used

=WeekDay(WORKED_DATE, 6)

This allows you to select the numeric value in the sort order.

Seems odd that it would not work the other way also...