Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get the Calendar with Only Year and Month?

Hi,

Currently I have data in the following ways:

Material     Month          Order#

M01          2012-01        540     

M01          2012-02        560          

M01          2012-03        640       

M01          2012-04        580       

M01          2012-05        510

M02          2012-01        340     

M02          2012-02        360          

M02          2012-03        140       

M02          2012-04        580       

M02          2012-05        810  

I want to creat a bar chart with Month Range Selection.

I noticed that this could be done by Slide or Calendar, however, i wonder how i can create a Calendar without date?

Could anyone please help?

Thanks in advance

Jerry

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

In this sort of situation, useFor your dimension for your dimension:

     Date(MonthStart(Date#(Month, 'YYYY-MM')), 'YYYY-MM')

Now it does not matter which day in the month you select.

If you really dont like the calendat object which will not allow you to select a month only, create month and year list boxes

     Month(Date#(Month, 'YYYY-MM'))

     Year(Date#(Month, 'YYYY-MM'))

(These will work in the front end, but for performance, all these transforms are best done in your script)

Hope that helps.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

9 Replies
Not applicable
Author

you can do it on many ways, for example paste this expression as a dimension

=makedate(left(Month,4),right(Month,2),1)

Not applicable
Author

Hi Pari,

Thanks for your reply.

But the new dimension, the data will be transfromed into YYYY-MM-01, is there any solution to ignore 01 in the Calendar?

for example, to set up a Calendar like:

    2012

Jan  Feb Mar Apr

May Jun Jul   Aug

Sep Oct Nov Dec

Regards

Jerry

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

In this sort of situation, useFor your dimension for your dimension:

     Date(MonthStart(Date#(Month, 'YYYY-MM')), 'YYYY-MM')

Now it does not matter which day in the month you select.

If you really dont like the calendat object which will not allow you to select a month only, create month and year list boxes

     Month(Date#(Month, 'YYYY-MM'))

     Year(Date#(Month, 'YYYY-MM'))

(These will work in the front end, but for performance, all these transforms are best done in your script)

Hope that helps.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

=monthname(makedate(left(Month,4),right(Month,2),1))

Not applicable
Author

yeah, this looks more proffesional:))

Not applicable
Author

Hi Jonathan,

It is cool!

but i have another question regarding to this solution, how can i create a value range based on that one?

with the list box, i can only choose the specified month for my chart, do you have any ideas?

Regards

jerry

Not applicable
Author

Hi Pari,

If i creat a Calendar object with this variable, the value can not be displayed, do you have any ideas?

Regards

Jerry

jonathandienst
Partner - Champion III
Partner - Champion III

Jerry

That is a different question. For the best response, I would suggest that you create a new post.

In the post, provide details of the ranges you want (eg MTD based on the selected month/year, YTD, prior MTD, prior YTD etc etc).

There are many ways of dong this and the best way will depend on your model's data structure, the user requirements etc etc. The more information you provide, the better. If possible, post your model or a representative sample when you create the new post.

BTW if the original question has been answered, please mark the correct answer.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Jonathan,

Thanks for your help, I will make a new post.

Regards

Jerry