Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
Qlik_here
New Contributor

Calculate distribution (%) based on column values

Hi guys,

My data is organized below and I would like to make a bar graph with the dimension being Company and the graph will show the distribution of gender (Male/Female) for each company. (e.g. For A, it will show two bars, first bar is 40% for Male and second bar is 60% for Female) Is this possible to do it inside set analysis? I don't want to create a separate table from the main one.

CompanyMaleFemale
A2030
B3020
C1012

 

All help and feedbacks are appreciated! Just let me know if you guys need more details.

2 Replies
Highlighted
Partner
Partner

Re: Calculate distribution (%) based on column values

You can do it 2 ways

1 with the current table structure

Company as dimension and  expressions Sum(Male)/Sum(Male+Female) and Sum(Female)/Sum(Male+Female)

2 this in my opinion is the more flexible option. you transform the table using cross table to

CrossTable (Sex,Count,1)
load * inline [
Company,	Male,	Female
A,	20,	30
B,	30,	20
C,	10,	12

];
CompanySexCount
AMale20
AFemale30
BMale30
BFemale20
CMale10
CFemale12

 

this make the datamodel more flexible

then create bar chart with dimensions Company and Sex

measure Sum(Count)/Sum(total <Company> Count)

Highlighted
Partner
Partner

Re: Calculate distribution (%) based on column values