Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Month over Month line chart

Hi,

I use the monthname function to convert a date to a month and the monthname does not get displayed in a line chart if I change the x-axis to be on continuous scale. But works fine on a BAR chart or TABLE box.

Is there a workaround for this?

khamtorajamohanisaaclinchooco_co

LINE CHART: x-axis is continuous, whereas I need a month name

2.PNG

BAR CHART: x-axis is fine

1.PNG

TABLE BOX: x-axis is fine

3.PNG

7 Replies
sunny_talwar

Would you be able to share a sample to look at?

Not applicable
Author

Sure, hereby attached a sample of the problem.

Not applicable
Author

It works without the continuous axis, but while going to alternate dimension of date it shows the first date instead of entire range

Patrik_Lundblad
Employee
Employee

To use the continuous axis with month labels you need to create an autocalendar in the script, as that's where the labels for the axis are generated. This can be done by either loading in your excel file through the Data manager or by adding an autocalendar to your script.

Here is the script you can add.

[autoCalendar]:

  DECLARE FIELD DEFINITION Tagged ('$date')

FIELDS

  Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),

  Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

  Month($1) AS [Month] Tagged ('$month', '$cyclic'),

  Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),

  Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),

  Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),

  Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),

  Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified');

DERIVE FIELDS FROM FIELDS [date] USING [autoCalendar] ;

Result using YearMonth, but you can also use Month.

Month.PNG

marcohadiyanto
Partner - Specialist
Partner - Specialist

Hi Vinol,

It's better you create master calendar and put your dimension there.

You can use script by Partrick or check this link

Creating a Master Calendar - YouTube

Regards,

Anonymous
Not applicable
Author

Hi Vinol,

Uncheck the option, 'Use continuous scale' under Appearance section to resolve this issue 

jomar_ebonite
Partner - Contributor III
Partner - Contributor III

Hi Vinol,

You may try the following expression:

=Month(date) & ' ' & Year(date)


Regards,

Jomar