5 Replies Latest reply: Sep 4, 2016 11:06 PM by MARCO HADIYANTO RSS

    Month over Month line chart

    Vinol Dsouza

      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?

       

      kha mtorajamohan isaaclin chooco_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

        • Re: Month over Month line chart
          Sunny Talwar

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

          • Re: Month over Month line chart
            Patrik Lundblad

            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

            • Re: Month over Month line chart
              MARCO HADIYANTO

              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,