Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Percentage Expression Problem

Hi.  I'm trying (and failing) to show the following in a single chart.  I've heavily simplified the data..

CategoryRelevant?
AY
A
AY
AY
B
BY
B

The 'Category' column is just a list of text, the 'Relevant?' column either has something in it or it doesn't.  I need to see the percentage of what is relevant, by category.

I'm currently using for the expression:

 

count([Relevant?])/count(Total [Category])

When one category is selected from the field, the chart correctly shows (for A, for example) 75% (count of 3 As with a Y in 'Relevant?' divided by a total count of 4 As), so this works.  The problem arises when both (for example) A and B are selected and shown on the same chart.  What the expression does is:

For A: 3 divided by 7  (3 As with a Y divided by the total number of As plus Bs (I think) which gives 43%, despite it showing 75% when just A is selected)

For B: 1 divided by 7 (1 B with a Y divided by the total number of Bs plus As which gives 14%)

I understand why it's doing this, it's showing the categories seperately on the chart but then dividing it by the total of the categories slected, for both categories.  I've tried a few different expressions but I can't seem to find one that will give me, on the same chart 3 divided by 4 for A and 1 divided by 3 for B ie divided by the total count for each category..?

I'm really new to this (sorry!), so give me a nudge if I've not been clear enough.

Thanks

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try: count([Relevant?])/count(Total <Category> [Category])


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try: count([Relevant?])/count(Total <Category> [Category])


talk is cheap, supply exceeds demand
Not applicable
Author

Amazing - Thank you!