Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to show percentage of total instead of absolute numbers

Hello,

QuikSense newbie here. I am trying to show Female vs. Male percentages by Job Level, and have absolute numbers in my data. Sample data below:-

   

Job LevelFemaleMaleTotal
Executive165190355
Director110012002300
Manager6500640012900
Professional122001150023700
Manufacturing155001450030000

I want to create a bar chart, but instead of showing absolute numbers, I want to show percentages of Female vs. Males. Something like this:-

I understand I will need to create a custom measure, like Female/Total *100 or something. But not sure what formula to use.

Thoughts?

Thanks in anticipation!

Ankit

1 Solution

Accepted Solutions
swuehl
MVP
MVP

What issues do you see? Incorrect numbers? No result? Error messages?

I think Oleg's solution should work:

Create a chart with two dimensions, [Job Level] and Gender

As expression, use

=Count(ID) / Count(TOTAL<[Job Level]> ID)

I assume you have distinct IDs in the ID column, so you don't need to use explicitely a count distinct.

If you still have issues, could you describe what exactely you have done and what you see (and maybe what you expect to see)?

View solution in original post

5 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Something like the following:

Count(ID) / count (TOTAL <[Job Level]> ID)

,assuming that each person is identified by the field ID.

cheers,

Oleg Troyansky

Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy and Austin, TX!

swuehl
MVP
MVP

Does your top table represent your raw data, i.e. a table from your model? Or do you have a table with fields Job Level, Sex, EmpID instead?

In latter case, you can do what Oleg suggested, create a chart with dimensions Job Level and Sex and the above expression (adapted to your field names).

In first case, you can consider transforming the table using CROSSTABLE LOAD prefix ( I think this would be best), then follow second case.

Or create a chart with dimension Job Level and two expressions:

=Num(Sum(Female) / Sum(Total),'#0.00%')

=Num(Sum(Male) / Sum(Total),'#0.00%')

Not applicable
Author

Oleg & Swuehl -

Thank you for your prompt responses. Appreciate it!

Good question, thanks for checking Swuehl. I have the latter. So my data does look like this:-

   

NameIDJob LevelRegionGender
asf123ExecutiveUSMale
asdfasdf234ProfessionalAPACFemale
asdfasdf345ProfessionalUSMale
asda456ManagerEuropeMale
sdasd567ProfessionalUS

Female

I tried the formulae you suggested as well as what Oleg suggested but I am not able to get it right. Based on my data above, do you have other thoughts?

Thanks again,

Ankit

swuehl
MVP
MVP

What issues do you see? Incorrect numbers? No result? Error messages?

I think Oleg's solution should work:

Create a chart with two dimensions, [Job Level] and Gender

As expression, use

=Count(ID) / Count(TOTAL<[Job Level]> ID)

I assume you have distinct IDs in the ID column, so you don't need to use explicitely a count distinct.

If you still have issues, could you describe what exactely you have done and what you see (and maybe what you expect to see)?

Not applicable
Author

It worked! Thank you both.