Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
sudhir0538
Contributor

Month Year

Hi Experts !

In my db month field is maintained in numeric form i.e 1,2,3,--12. and year field is also numeric like 2018,2019 and so on.

I want to display month year as a dimension in a bar chart. Any Ideas of how to achieve this field inside QV.

Thanks.

1 Solution

Accepted Solutions
MVP
MVP

Re: Month Year

...
Date(MakeDate(YearField, MonthField), 'yyyy-MM') as Date,
Month(MakeDate(YearField, MonthField)) as Month,
YearField as Year,
...

 

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

View solution in original post

10 Replies
mostwanted123
Contributor

Re: Month Year

Hi Sudhir,

Please find below code -

Month(MonthField) &'-'& YearField as Year-Month

Thanks

sudhir0538
Contributor

Re: Month Year

Hi @mostwanted123

Thanks for the reply but it's not working. Its combined and Only 3 months are displaying.

mostwanted123
Contributor

Re: Month Year

Can you share the screenshots of the code written by you and output ?

Thanks

sudhir0538
Contributor

Re: Month Year

Hi Please find the attached.
sudhir0538
Contributor

Re: Month Year

 
MindaugasBacius
Valued Contributor III

Re: Month Year

You need to create Master Calendar or else you will get not consistent Year-Month dimension.

Use simply Year & Month as [Year Month]

MVP
MVP

Re: Month Year

...
Date(MakeDate(YearField, MonthField), 'yyyy-MM') as Date,
Month(MakeDate(YearField, MonthField)) as Month,
YearField as Year,
...

 

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

View solution in original post

sudhir0538
Contributor

Re: Month Year

Hi iJonty,

Thanks for sharing the work around. It really works. Here in the dimension i want to show the months in descending format for only last 12 months. like today is month of July 2019 so data will be of July 2018 to July 2019. July 18/2018 August 2018 Sep 2018 and after dec 2018 jan 2019 should appear but not july 2019.

Can you help me achieve this. screenshot attached 

Highlighted
MVP
MVP

Re: Month Year

You are asking a new question now. I suggest that you mark this thread as answered (if you original question was answered) and open a new posting with the question. You can link back to this post if necessary.

I did not really understand what you were looking for in the new question and the screenshot did not help much. In the new post, please explain in more detail what you need and include a sample qvw (or a focussed screenshot) that illustrates the question more clearly.

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