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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
wokter
Contributor II
Contributor II

yearmonth data to dual

Hello,

I have a field called Yearmonth that starts from 201801 and goes up to this month.

I want to construct a dual so that 201801 = 1, 201802 = 2 , ... up until the last month in the dataset. Where the dataset gets updated every month.

Can somebody help me with this?

 

Kind regards,

 

 

Labels (1)
3 Replies
Or
MVP
MVP

num(left(Yearmonth,4))-2018 + num(right(Yearmonth,2)) should do the job, I think.

Floor(Yearmonth/100)-2018 + mod(Yearmonth,100) should also work if you prefer mathematical functions to string functions.

wokter
Contributor II
Contributor II
Author

Hello Or, 

thanks for the quick reply, still got a small problem. when i try it this is what i get in return

wokter_0-1626350505908.png

 

wokter
Contributor II
Contributor II
Author

num(((left([yearmonth],4))-2018)*12) + num(right([yearmonth],2)))

still a small error in the year 2018, but the rest of the data works, and i dont really need to use the 2018 data. So thank you for helping