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

 Company Male Female A 20 30 B 30 20 C 10 12

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

Labels (2)

2 Replies
Highlighted
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)
Company,	Male,	Female
A,	20,	30
B,	30,	20
C,	10,	12

];``````
 Company Sex Count A Male 20 A Female 30 B Male 30 B Female 20 C Male 10 C Female 12

this make the datamodel more flexible

then create bar chart with dimensions Company and Sex

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

Highlighted
Partner