Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Jensnr
Contributor
Contributor

Different sorting on multiple bar chart, table and box plot.

Hello

 

I'm rather new to qlik (mostly been using Microsoft Power Bi)

 

My current issue, which i haven't been able to figure out, or find solutions to on the forums is as follows:

 

i have a Qlik app, monitoring assignments plottet out throughout the day.
As of right now it is sorting based on the clock (24 hours), where it starts at 1 at night, and goes all the way down to 24.
However, the drivers shifts starts at 7 in the morning, and ends at 6 in the morning.
I'm trying to sort so the first number will be 7, and then it counts all the way down to 6.

The table looks as follows:

Jensnr_0-1625208289419.png

Where the column to the left (Klokketimer) is the one i'm trying to sort.

the column's expression is: =if(hour(Oprettet)=0, 24, (hour(Oprettet)))

Where oprettet is a label for a created variable.

I have tried the following sorting expressions:

match(Oprettet, '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '1', '2', '3', '4', '5', '6')

 

If(Oprettet = '7',1, If(Oprettet = '8',2, If(Oprettet = '9',3, If(Oprettet = '10',4, If(Oprettet = '11',5, If(Oprettet = '12',6, If(Oprettet = '13',7, If(Oprettet = '14',8, If(Oprettet = '15',9, If(Oprettet = '16',10, If(Oprettet = '17',11, If(Oprettet = '18',12, If(Oprettet = '19',13, If(Oprettet = '20',14, If(Oprettet = '21',15, If(Oprettet = '22',16, If(Oprettet = '23',17, If(Oprettet = '24',18, If(Oprettet = '1',19, If(Oprettet = '2',20, If(Oprettet = '3',21, If(Oprettet = '4',22, If(Oprettet = '5',23, If(Oprettet = '6',24))))))))))))))))))))))))

Without any luck. 
My next course of action is probably to try to do some sort of textstring conversion/sorting

Have someone ran into something like this, who can help with a solution?

 

Best regards and thanks in advance

Jens Rasmussen

Labels (3)
1 Solution

Accepted Solutions
UncleRiotous
Creator
Creator

The way I'd do it is to sort by expression and try...

=If(Oprettet <7,Oprettet +20,Oprettet -6)

I gave it a quick try on some scratch data and it worked for me. This would work as well but somehow feels wrong to me...

=If(Oprettet <7,Oprettet +25,Oprettet)

View solution in original post

2 Replies
UncleRiotous
Creator
Creator

The way I'd do it is to sort by expression and try...

=If(Oprettet <7,Oprettet +20,Oprettet -6)

I gave it a quick try on some scratch data and it worked for me. This would work as well but somehow feels wrong to me...

=If(Oprettet <7,Oprettet +25,Oprettet)

Jensnr
Contributor
Contributor
Author

Hi UncleRiotous

It worked perfectly, thank you!