3 Replies Latest reply: Mar 24, 2016 4:14 AM by Isabelle Timmermans RSS

    100% Stacked bar with aggregate

    Isabelle Timmermans



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

      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:
























      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?



      Kind regards,