Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
alespooletto
Creator II
Creator II

Creating an "Others" bar with average values by groups

Hello, 

I currently have a very simple bar chart counting the number of tickets opened by specific people. I want to show the top 5 users, but at the same time show an "Others" bar that has the average of tickets opened by other people. 

So right now its like this 

image.png

And I woudl like to visualize it like this, where the red shows the average of tickets opened by the rest of the people. I don't necessarily need help with this measure, but more with how to make this happen? 

image.png

 

Because in the graph, I only see the option to add others but not to choose what the others represent 

alespooletto_1-1732891070199.png

 

 

Labels (2)
1 Solution

Accepted Solutions
rubenmarin
MVP
MVP

That's the only measure the chart needs.

Instead of "Count(TKT_Contact)" use "Avg(Aggr(Count(TKT_Contact),[DimensionField]))", where DimensionField is the field used as dimension in the bar chart

View solution in original post

9 Replies
rubenmarin
MVP
MVP

Hi, you can use an expression like:

Avg(Aggr(Count(YKY_Contact),[DimensionField]))

DimensionField is the field used as dimension in the bar chart.

nimishpgupta
Contributor II
Contributor II

You can create two different expression, sample code below

Tickets:
Load * Inline
[

User,TicketNo
A,A1
A,A2
A,A3
A,A4
A,A5
A,A6
B,B1
B,B2
B,B3
B,B4
B,B5
C,C1
C,C2
C,C3
C,C4
D,D1
D,D2
E,E1
E,E2
F,F1
F,F2
F,F3

];

 

Chart Expressions:

Top N:

count({<User = {"=Rank(count(TicketNo))<=3"}>}TicketNo)

Average:
avg(aggr({<User = {"=Rank(count(TicketNo))>3"}>}count(TicketNo),User))

Limit the dimension to show only Top N Users

nimishpgupta_1-1732962431309.png

 

Below is the output Chart

nimishpgupta_0-1732962327255.png

You can create Master Measures to customise the colors of the Bars.

 

 

alespooletto
Creator II
Creator II
Author

Hello @nimishpgupta , thanks for the answer. 

 

Can you tell me where should I put those measures you created? 

nimishpgupta
Contributor II
Contributor II

It has to be added as measures to your bar chart, two seperate measures

MK_QSL
MVP
MVP

Add an extra Inline table as below

DIM:
Load * Inline
[
Dimension
User
Average
];

 

Now create bar chart as 

Dimension 

=PICK(Match(Dimension, 'User','Average'), User, 'Average')

 

Expression

IF(Dimension = 'User',
Count({<User = {"=Rank(Count(Distinct Ticket)) <= 3"}>}Distinct Ticket),
Avg(Total Aggr(Count({<User = {"=Rank(Count(Distinct Ticket)) > 3"}>}Distinct Ticket),User))
)

 

rubenmarin
MVP
MVP

Have you tried my answer? You only need to use this expression: Avg(Aggr(Count(YKY_Contact),[DimensionField]))

alespooletto
Creator II
Creator II
Author

Thanks for your suggestion @rubenmarin , but it's not clear where should I add your measure?

rubenmarin
MVP
MVP

That's the only measure the chart needs.

Instead of "Count(TKT_Contact)" use "Avg(Aggr(Count(TKT_Contact),[DimensionField]))", where DimensionField is the field used as dimension in the bar chart

alespooletto
Creator II
Creator II
Author

Okay, this is definitely the easiest option. Thanks Ruben!