Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
FlAsh92
Contributor III
Contributor III

Group Bar Chart Month-wise

Sample1.png

This my sales chart. I would like to be able to compare my monthly sales over year. For this, I need to group the bars month wise.

For eg: for the above chart i want the bars to be displayed in the following order: 2012 Jan, 2013 Jan, 2014 Jan, 2012 Feb, 2013 Feb, 2014 Feb.

Kindly suggest the changes that need to be made in the presentation of the chart

Labels (1)
1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi 

why did you change the dimension 

you just need to use this expression under the sort option of the dimension 

so go back to your basic dimension , and under the sort settings select the option to sort by expression 

View solution in original post

9 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 

you can sort the month dimension with expression like this 

num(month(DIMENSION FIELD)) + year(DIMENSION FIELD)/100000

FlAsh92
Contributor III
Contributor III
Author

hello @lironbaram , thanks for the reply!!

The expression that you shared works perfectly!!

But the only issue is the labels at the bottom of each bars, they do not display the Year-Month anymore. Attaching the screenshot below.Sample2.png

Kindly suggest a solution if its possible to display the labels as before.

Thanks in advance!!

Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi Ash

I thought I would just add my 2 cents. In you Bar chart you can also add two dimensions, the one will be Group and the other one will be Bar. I just used it in one of my apps to show you how it works:

Bar Chart with Grouped bars.PNG

I just used the autocalendar year and month for the dimensions.

Good luck,

Mauritz

FlAsh92
Contributor III
Contributor III
Author

hey @Mauritz_SA ,

thanks for that reply!!

But if you can see my graph, I'm already using 2 dimensions. One is Year-Month and the other is Product Type. So, when I split Year and Month, it becomes 3 dimensions...which is not viable for Bar Graph.

lironbaram
Partner - Master III
Partner - Master III

hi 

why did you change the dimension 

you just need to use this expression under the sort option of the dimension 

so go back to your basic dimension , and under the sort settings select the option to sort by expression 

lironbaram
Partner - Master III
Partner - Master III

hi 

why did you change the dimension 

you just need to use this expression under the sort option of the dimension 

so go back to your basic dimension , and under the sort settings select the option to sort by expression 
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi Ash

Sorry, I didn't read properly Smiley Happy. What @lironbaram said in the next post will work (using it to sort the original dimension).

Regards,

Mauritz

FlAsh92
Contributor III
Contributor III
Author

@lironbaram thanks buddy!!

Worked perfectly!!

VisualUK
Contributor II
Contributor II

hi

I am actually trying to do the same thing, but unable to find a solution. Completely new to QV and learning as i go. 

My dimension is: date(Monthname([CAT.Created]),'MMM')

My Expression is: Count({1<CAT_Ticket_ID>}CAT_Ticket_ID) - cannot be impacted by other user's selections

Dimension sort added is: num(month(CAT.Created)) + year(CAT.Created)/100000

I am getting the following bar chart. 

- Jan, Feb, Mar    (2018) || Jan, Feb, Mar, ... (2019) || Jan, Feb, Mar.... (2020)

What i would like seeing is: 

- Jan '18, Jan '19, Jan'20 || Feb'18, Feb'19, Feb '20... and so on

any help highly appreciated...