Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change the month values on the X-Axis of a bar chart?

I have a simple bar chart that is showing sales per month.  In order to create the chart, I added the field Month as the Used Dimension, and added an expression, eSumSales, to sum the sales per month.  The chart is correctly showing me the sales per month over a six month period, but the X-Axis is showing 1 for January, 2 for February, etc..  If I change the Used Dimension to Month Name, the month names show as they should, but the sort order, which was previously set to Numeric Value Ascending, changes to Text A -> Z, and months are listed as follows: April, February, January, etc... 

Can someone share with me how I can retain the Sort of the Numeric values of the Month field (i.e, 1, 2, 3) while displaying the values of the Month Name (Jan, Feb, Mar) field?  I would ideally like to abbreviate the Month Name field in the process to only list the first three letters.

Thank you in advance for any assistance.  I know this is basic stuff....

1 Solution

Accepted Solutions
Not applicable
Author

HI ,

        The Month field which you used as Dimension ,

try to include the Expression in the Sort Tab like below

num(month(Date))

Place this Expression in the Sort tab and set it to Ascending .

But in the Dimensio use  "month(Date)" only .

Please reply me for the same .

Thanks

View solution in original post

6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try to create a Month field as shown below in script.

     Month(Date) as Month.

     If you dont want to change anything in script, you can use below expression in sort tab of your chart.

     if(Month = 1,'Jan',

          if(Month = 2,'Feb',..... and so on.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

HI ,

        The Month field which you used as Dimension ,

try to include the Expression in the Sort Tab like below

num(month(Date))

Place this Expression in the Sort tab and set it to Ascending .

But in the Dimensio use  "month(Date)" only .

Please reply me for the same .

Thanks

Not applicable
Author

Thank you Yusuf.  I incorporated a variation of the changes you mentioned, and I was able to get the desired result.  I used Month Name as the Used Dimension, used the Left function to grab the first three characters of the dimension, and used the num(Month) code in the Sort tab to list the months properly along the x-axis.

Thanks again,

Jeff

Not applicable
Author

Hey, what if i have a master calendar like this

"jan, feb, mar.." and i want "Jan, Feb, Mar, May"

first  in upper case

thanks

Not applicable
Author

I think we can also use Applymap() for this.

chtat61
Contributor
Contributor

Hi,

you can with PICK() the month as monthname to see on x-axis

Instead the dimension MONTH, create a calculates dimension:

PICK(MONTH, 'Jan','Feb','Mrz','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez')

If you choose option 'Continuous' on tab axis, x-values must be a number.

You must create 12 points on x-axis for your 12 month:

Static Min = 12, Static Max=375 , Static Step = 30

You have now 12 points for 12 months.

Go to tab Number, select Continous X-axis, choose Date and replace Format Pattern with MMM

You say Qlik also, your x-values are date and they should be showed as monthname.

Now, you must synchronize your dimension MONTH to x-values, with the function PICK()

Pick(MONTH, 30,60,90,120,150,180,210,240,270,300,330,360)

I call the calc. dim. as MONTH@X

Now, you have your MONTHs as monthnames on x-axis.

Regards

cht