Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rammuthiah
Creator III
Creator III

How to Sort based on Date and within date, sort by region in Qlik Sense

Hi,

I have date and region and have to sort based on date and within date sort by region

Region order would be EU, NA, and AP for each date. This I need to sort in the script

Input:

Date Region Count
5/10/2022 AP 3
5/12/2022 AP 6
5/10/2022 EU 2
5/11/2022 EU 2
5/12/2022 EU 9
5/10/2022 NA 3
5/10/2022 NA 4
5/11/2022 NA 1

 

Output be like below:

Date Region Count
5/10/2022 EU 2
5/10/2022 NA 3
5/10/2022 NA 4
5/10/2022 AP 3
5/11/2022 EU 2
5/11/2022 NA 1
5/12/2022 EU 9
5/12/2022 AP 6
Labels (3)
3 Solutions

Accepted Solutions
rammuthiah
Creator III
Creator III
Author

Thank you, Mayil Vahanan. This I need to sort in the script.

View solution in original post

MayilVahanan

Hi

Try like below

Temp:
Load *, Match(Region, 'EU', 'NA', 'AP') as RegionSort Inline
[
Date Region Count
5/10/2022 AP 3
5/12/2022 AP 6
5/10/2022 EU 2
5/11/2022 EU 2
5/12/2022 EU 9
5/10/2022 NA 3
5/10/2022 NA 4
5/11/2022 NA 1
](delimiter is ' ');

Final:
NoConcatenate
Load * resident Temp order by Date, RegionSort;

Drop Table Temp;

MayilVahanan_0-1653458375553.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

rammuthiah
Creator III
Creator III
Author

I have formatted the date and used Id for region and it works.

rammuthiah_0-1653463122209.png

 

View solution in original post

4 Replies
MayilVahanan

Hi 
Try like below

MayilVahanan_1-1653456718387.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
rammuthiah
Creator III
Creator III
Author

Thank you, Mayil Vahanan. This I need to sort in the script.

MayilVahanan

Hi

Try like below

Temp:
Load *, Match(Region, 'EU', 'NA', 'AP') as RegionSort Inline
[
Date Region Count
5/10/2022 AP 3
5/12/2022 AP 6
5/10/2022 EU 2
5/11/2022 EU 2
5/12/2022 EU 9
5/10/2022 NA 3
5/10/2022 NA 4
5/11/2022 NA 1
](delimiter is ' ');

Final:
NoConcatenate
Load * resident Temp order by Date, RegionSort;

Drop Table Temp;

MayilVahanan_0-1653458375553.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
rammuthiah
Creator III
Creator III
Author

I have formatted the date and used Id for region and it works.

rammuthiah_0-1653463122209.png