Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

dhulipudi
New Contributor

100% Bar chart with 2 dimensions and one measure

Hi All,

Is it possible to create a 100% stacked bar with 2 dimensions and 1 measure

I have a bar chart with some sales value for 2 years.

Required: Create alternate measure to fit in fig 1 to show 100% split between products (as shown in Fig 3)

What I am getting is Fig 2 split between years as alternate measure.

I can create 4 measures to get total to 100% but its not ideal as I will be duplicating 10 graphs for # and %.

Sales report.JPG

Fig 1 measure: Sum(Sales)

Fig 2:  Sum(Sales) /sum(total <Year> Sales)

Fig 3:

Currently creating 4 measure for each product:

num(sum({$<Product={'P1'} >} Sales)

/sum({<Product= {'P1','P2','P3','P4'}>}Sales),'#,##0%')

Is there any way I can create a one measure to get these split for products to be 100% with 2 dimensions.

4 Replies

Re: 100% Bar chart with 2 dimensions and one measure

What is your first dimension? Is it Year or something else?

dhulipudi
New Contributor

Re: 100% Bar chart with 2 dimensions and one measure

First Dimension: Year

Second Dimension: Product

Re: 100% Bar chart with 2 dimensions and one measure

Is year a calculated or derived field by any chance?

dhulipudi
New Contributor

Re: 100% Bar chart with 2 dimensions and one measure

I have edited the Auto calendar to derive a YearAgo field for Total year & last Year 

if(12*Year(Today())+Month(Today())-12*Year($1)-Month($1) >=1 and 12*Year(Today())+Month(Today())-12*Year($1)-Month($1) <= 12, 'Total Year',

if(12*Year(Today())+Month(Today())-12*Year($1)-Month($1) >=13 and 12*Year(Today())+Month(Today())-12*Year($1)-Month($1) <= 24,'Last Year',null())) as YearAgo,

Community Browser