Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

ift_isabelle
Contributor II

100% Stacked bar with aggregate

Hi,

I have customer data about their spend TV, Radio and Internet on a specific date, like in this table

CustomerMediumtypeDateSpend
ATV1/1/2016€ 100
ATV2/1/2016€ 600
ARadio1/1/2016€ 250
AInternet3/1/2016€ 20
BTV1/1/2016€ 80
BRadio1/1/2016€ 65

I want to make a 100% stacked bar chart per customer split on the mediumtypes. Like this:


Example.PNG

I tried to make an aggregation, but none of these work, it's not adding up to 100%:

sum({<year=2016,"Media Type"=>}Spend)/ aggr(sum({<year=2016,"Media Type"=>}Spend),Customer)

aggr(sum({<year=2016>}Spend), [Media Type], Customer)/ aggr(sum({<year=2016>}Spend), Customer)

sum({<year=2016>}Spend)/ sum(aggr(sum({<year=2016>}Spend),  Customer))

sum({<year=2016>}Spend)/ sum(aggr(sum( {<year=2016>}Spend), Customer))

sum({<year=2016>}Spend)/ sum( { total <year=2016>}Spend))


What am I doing wrong? Can you help me?

Thanks!

Kind regards,

Isabelle

1 Solution

Accepted Solutions
MVP
MVP

Re: 100% Stacked bar with aggregate

Hi,

Try

=sum({<year={'2016'}>}Spend)/ sum( { <year={'2016'}>} TOTAL <Customer> Spend)


Hope this helps you.


Regards,

Jagan.

3 Replies

Re: 100% Stacked bar with aggregate

Try sum(Spend)/sum(TOTAL <Mediumtype> Spend)

ift_isabelle
Contributor II

Re: 100% Stacked bar with aggregate

I tried sum(Spend)/sum(TOTAL <Customer> Spend) and that worked perfect!


Thanks!

MVP
MVP

Re: 100% Stacked bar with aggregate

Hi,

Try

=sum({<year={'2016'}>}Spend)/ sum( { <year={'2016'}>} TOTAL <Customer> Spend)


Hope this helps you.


Regards,

Jagan.