# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
AInternet3/1/2016€ 20
BTV1/1/2016€ 80

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

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

## 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
MVP

## Re: 100% Stacked bar with aggregate

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

Contributor II

## Re: 100% Stacked bar with aggregate

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

Thanks!

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.