Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Groups in bar charts

Hi,

At the moment I have two bar charts to show the sales distribution on gender and age group.

First bar chart:

  • dimension: paymentYM
  • expression: male
    • calculation: sum({<Gender = {'male'}>} sales)
  • expression: female
    • calculation: sum({<Gender = {'female'}>} sales)

Second bar chart:

  • bar chart: paymentYM
  • expression: 21-40
    • calculation: sum({<AgeGroup = {'21-40'}>} sales)
  • expression: 41-60
    • calculation: sum({<AgeGroup = {'41-60'}>} sales)

I want to combine these two bar charts into only one bar chart with a group button where I can chose to look at gender or age group. Is this possible?

I've already tried to put all genders in one group and all age groups into one group, but when I run the bar chart it will only show one gender together with one age group at the time.

Thanks ahead!

1 Solution

Accepted Solutions
Not applicable
Author

Found the answer!

sum(sales) / sum(TOTAL <paymentYM> sales)

View solution in original post

9 Replies
vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi,

You can use expression =Sum(Sales) and create a cyclic drill of Gender and Age Group. You do not need to write seperate expression.

Regards

VIjay

Not applicable
Author

Hi,

sorry, I missed an important thing in my calculation. All calculations should be an %-age of the total amount per month.

Like this:

  • expression: male
    • calculation: sum({<Gender = {'male'}>} sales) / sum(sales)
  • expression: 21-40
    • calculation: sum({<AgeGroup = {'21-40'}>} sales) / sum(sales)

/Fredrik

vijay_iitkgp
Partner - Specialist
Partner - Specialist

You can use Expression Sum(Sales)/Sum(Total Sales)

Not applicable
Author

It almost worked. But the TOTAL takes the totals sales for all month. I only want the TOTAL sales per month

vijay_iitkgp
Partner - Specialist
Partner - Specialist

If Month is not selected it will give you total value for all months but if you select a month it will give you total value of selected month only.

Not applicable
Author

Okey, but if I want it on each month without selecting a month .. the result should be presented on a dashboard where no selection can be made

vijay_iitkgp
Partner - Specialist
Partner - Specialist

If you want it for one month on dashboard then you need to include month in expression.

Eg: =sum( {<Month= {"$(=Max(Month))"} >} Sales)/sum( {<Month= {"$(=Max(Month))"} >} Total Sales)

Not applicable
Author

Sorry if I'm not making myself clear enough.

What I want is the sales distribution %-age per gender and age group (as a cycle/drill) in the same stacked bar chart divided on month for all payment months ever.

Not applicable
Author

Found the answer!

sum(sales) / sum(TOTAL <paymentYM> sales)