Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

jiwaniakbiar
New Contributor

Bar Chart with two dimensions showing relative percentage

Hi

I have a table that looks something like this.

SurveyNoYearGenderValidResponseFlag
12015MaleY
22015FemaleY
32015FemaleY
42015FemaleY
52015MaleY
62015FemaleY
72015FemaleY
82015MaleY
92015FemaleN
102019FemaleY
112019FemaleY
122019FemaleY
132019MaleY
142019FemaleY
152019MaleY
162019FemaleY
172019FemaleN

 

I want to show a Bar Chart with 2 dimensions. -Gender and Year. Measure being the Percentage of Male and Femael over Total of the respective Years.

So on Bar chart it should show

Male should two bars side by side. 2015 with (3/8)37.5% and 2019 (2/7)28.57%.

Female should two bars side by side. 2015 with (5/8)62.5% and 2019 (5/7)71.42%. 

I used the measure Count({<ValidResponseFlagInd={"Y"}>} ([Gender]))/COUNT(TOTAL{<ValidResponseFlagInd={"Y"}>} ([S.No]))

However, this is using denominator as total of 2015 and 2019. i.e.

Male  2015 with (3/15)20% and 2019 (2/15)13.33%

Female 2015 with (5/15)33.33% and 2019 (5/15) 33.33%

Please advise