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: 
Anonymous
Not applicable

[*] Question about a Month-Year format [*]

Dear experts,

I have a master calender with a field [YearMonth]
In an other table I have the fields [Year] and [Periode]

I am trying to link the table to the calender by combining the [Year] and [Periode] field as [YearMonth]
This works but both fields [YearMonth] have a different format and so the data does not match.

The [YearMonth] form the master calender is generated this way:

date(monthstart(Date), 'YYYY-MM') AS YearMonth,

And from the other table this way:

(Year&'-'&Periode) as YearMonth,

Both generate the same information only the [YearMonth] from the calander is alinged to the left and from the other one is alinged to the right.

The question is: How do I get (Year&'-'&Periode) into a (date() 'YYYY-MM'))-format?

1 Solution

Accepted Solutions
hector
Specialist
Specialist

Hi, with the date you only are formating the value, but internally still have the day (in this case the 1st of each month), so try this

date(makedate(Year,Periode),'YYYY-MM') as YearMonth


Periode must be a value between 1 - 12

Hope this helps

Rgds

View solution in original post

2 Replies
hector
Specialist
Specialist

Hi, with the date you only are formating the value, but internally still have the day (in this case the 1st of each month), so try this

date(makedate(Year,Periode),'YYYY-MM') as YearMonth


Periode must be a value between 1 - 12

Hope this helps

Rgds

Anonymous
Not applicable
Author

Yes Perfect! Just what I need.

Thanks Yes