Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
kiansin
Contributor
Contributor

Custom the Months Sequence

Hello !!

I have a attached table as below :

kiansin_0-1658307862147.png

My question is I want the column "SalesPeriodYearMonth" format become to Year + Month Name 

For example : the expected result should be become "2022 Oct" instead of "202201 
In my custom months sequences should be like this as below :

kiansin_1-1658308075931.png

Do you know how should I do this please? Thank you very much in advance. Cheers!

 

Labels (1)
4 Replies
Rajashekar
Contributor III
Contributor III

hi @kiansin 

The SalesPeriodYearMonth is in string format. first you need to interpret it as Date using date# function then you can represent it in any format using Date function.

example:


Load
Date(Date1,'YYYY MMM') as Date1     // here you can use any format
;

Load
Date#(Date1,'YYYYMM') as Date1     //This will interpret the first 4 digits as year and the next 2 digits as a month.
;

Load * Inline [
Date1
202201
202202
202203
202204
];

result: 

Rajashekar_0-1658311773761.png

note: as we are not supplying any date here. if you try to display date by default it is 1. like 2022 Jan 01

 

Mark_Little
Luminary
Luminary

Hi there,

I would just join your period table to your month field in the data and the you can just order by expression and choose the period field.

 

 

kiansin
Contributor
Contributor
Author

Hi there,

Can you provide me the script of your solution please ?

kiansin
Contributor
Contributor
Author

Hi there,

Do you know how to sort it by sequence for the "NewDate1"? 

kiansin_0-1658384309313.png

For example : The sequence should be 2021 Oct , 2021 Nov , 2021 Dec, 2022 Jan , 2022 Feb, 2022 Mar and so on.