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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
sifatnabil
Specialist
Specialist

Serialize month and year

Hi all,

I would like the month & year (e.g. Apr 2016) to be serialized where each month increases by 1. So for example, if my data starts from Oct 16, the serial field should look like this:

  

MonthYearSerial
Oct-161
Nov-162
Dec-163
Jan-174

How can this field be created? Thanks.

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer
MVP
MVP

Try it with: autonumber(MonthYear) as MonthYearSeriell

Edit: For this you will need a sorted load which is already quite common by using a master-calendar.

- Marcus

View solution in original post

2 Replies
marcus_sommer
MVP
MVP

Try it with: autonumber(MonthYear) as MonthYearSeriell

Edit: For this you will need a sorted load which is already quite common by using a master-calendar.

- Marcus

MK_QSL
MVP
MVP

Data:

Load

  *,

  If(MonthYear = Date#('Oct-16','MMM-YY'),

  1,

  1+ Year(MonthYear)*12+Month(MonthYear)-(Year(Date#('Oct-16','MMM-YY'))*12+Month(Date#('Oct-16','MMM-YY')))) as ID

;

Load

  Date#(MonthYear,'MMM-YY') as MonthYear

Inline

[

  MonthYear

  Oct-16

  Nov-16

  Dec-16

  Jan-17

];