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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Average in chart

Hi folk,

I have a chart with 1 dimension Campaign.

I want to show difference between each given Campaign and Average of these Campaign (without None).

How can I get average in the chart.

Please see my file.

Picture1.jpg

1 Solution

Accepted Solutions
whiteline
Master II
Master II

Lets do it a bit carefully.

CampaignRatioCount({<Campaign=-{'None'}>} Campaign)Count(TOTAL Campaign)
4,63%3451862
Campaign A5,80%1081862
Campaign B6,02%1121862
Campaign C4,46%831862
Campaign D2,26%421862

You can see that 4,63% = Average(5.8%, 6.02%, 4.46%, 2.26%) = .. = (108+112+83+42)/1862/4

So to get the average use this expression:

Count({<Campaign=-{'None'}>} total Campaign)/Count(TOTAL Campaign)/Count({<Campaign=-{'None'}>} distinct total Campaign)

View solution in original post

9 Replies
whiteline
Master II
Master II

Hi.

Could you describe what do you mean by 'average', since none of expressions provided is definitely clear.

Anonymous
Not applicable
Author

Sum of each campaign / count these campaign.

Capture.JPG.jpg

Other words

6%+6%+4%+2%=18%

18%/4=4.5%  -------------average of Campaign

And then I need each given % of Campaign - Average of Campaign

6%-4.5=1.5%   - Campaign A

6%-4.5=1.5%   - Campaign B

4%-4.5%=-0.5% - Campaign C

2%-4.5%=-2.5% - Campaign D

Thanks,

Not applicable
Author

avg is usually sum of some value by number of elements.

You trying to sum Campaing. But Capaign it is string in your data!

Anonymous
Not applicable
Author

Yes, Campaign is string variable. I got percentage for each campaign, but I don't know how to get sum of my percentage for each campaign.

whiteline
Master II
Master II

Lets do it a bit carefully.

CampaignRatioCount({<Campaign=-{'None'}>} Campaign)Count(TOTAL Campaign)
4,63%3451862
Campaign A5,80%1081862
Campaign B6,02%1121862
Campaign C4,46%831862
Campaign D2,26%421862

You can see that 4,63% = Average(5.8%, 6.02%, 4.46%, 2.26%) = .. = (108+112+83+42)/1862/4

So to get the average use this expression:

Count({<Campaign=-{'None'}>} total Campaign)/Count(TOTAL Campaign)/Count({<Campaign=-{'None'}>} distinct total Campaign)

Anonymous
Not applicable
Author

Yes, Thanks my friend

Not applicable
Author

I think whiteline showed you solution. If you will need more help, let us know.

regards

Darek

Anonymous
Not applicable
Author

Thanks for helping

maxgro
MVP
MVP

I choose another field in your data; if my idea is correct, adapt to your requirement

(

sum({<Campaign=-{None}>} [Purchase Horizon Score] )

/ Count({<Campaign=-{None}>}Campaign)

)

-

(

sum(TOTAL {<Campaign=-{None}>} [Purchase Horizon Score] )

/ Count(total {<Campaign=-{None}>} Campaign)

)

1.png