Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
QlikSenseEJW
Contributor II
Contributor II

% in barchart with aggr

Dear,

At the moment I am trying to make a bar chart with as group year-month and as bar a certain categoy.

As measure I'd like to have percentages of the group (year-month). Say I have in a certain year-month 100 people in total of which 25 in category 1 and 75 in category 2. I get the right percentages in a table, but when I try to calculate it in the barchart using the aggr function I get only one of both percentages. When I add the total hardcoded I get both.

How can I make sure both percentages are shown in the bargraph?

Below what I am using at the moment but does not show the correct results.

Sum({<
>} [Measure])
/
Sum(
Aggr(
Sum({<
>} Measure])
, [year-month]))

 

Many thanks for helping me out.

 

 

Labels (3)
2 Solutions

Accepted Solutions
theoat
Partner - Creator III
Partner - Creator III

Try this :
Sum(Measure])
/
Sum(Aggr(NODISTINCT
     Sum({<Category =>} Measure])
     , [year-month]))

Kind regards,
Théo ATRAGIE.

View solution in original post

QlikSenseEJW
Contributor II
Contributor II
Author

Dear Theo, 

Thanks so much! Thanks to your input with one small change the barchart shows the correct results!

Sum(Measure])
/
Only(Aggr(NODISTINCT
     Sum({<Category =>} Measure])
     , [year-month]))

Kind regards!

View solution in original post

5 Replies
theoat
Partner - Creator III
Partner - Creator III

Can you put a visual example of what you're expecting? (The table for example).

Kind regards,
Théo ATRAGIE

QlikSenseEJW
Contributor II
Contributor II
Author

Hi Theo,

Thank you for your reply. Below an example of the table with the percentages. Below it an example of the barchart, however with counts not %. When I try to show them as percentages of the total of the group (say 24-02 for instance) I get just one of both percentages.

 

Year-Month Total Category 1 Category 2 Category 1 Category 2
24-01 7.816 2113,729713 5701,821626 27,0% 73,0%
24-02 3.777 1418,119653 2358,904591 37,5% 62,5%

 

QlikSenseEJW_0-1708081964894.png

Kind regards!

theoat
Partner - Creator III
Partner - Creator III

I try to do this in 20 minutes.

theoat
Partner - Creator III
Partner - Creator III

Try this :
Sum(Measure])
/
Sum(Aggr(NODISTINCT
     Sum({<Category =>} Measure])
     , [year-month]))

Kind regards,
Théo ATRAGIE.

QlikSenseEJW
Contributor II
Contributor II
Author

Dear Theo, 

Thanks so much! Thanks to your input with one small change the barchart shows the correct results!

Sum(Measure])
/
Only(Aggr(NODISTINCT
     Sum({<Category =>} Measure])
     , [year-month]))

Kind regards!