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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Basic count() question?

Hello!

I have a rather basic question regarding a graph expression.

I have campaign data for my customers. Each customer can be a member of a campaign. In each campaign I store a response value (YES/NO/NO ANSWER)

Now I wish to make a hitrate graph where I have one bar per campaign, and the bar divided into the response values (YES, NO etc). I want the expressions to be relative.

The problem is that when I only have one campaign, the different categories sum up to 100%, but when i add another campaign, the values of the TWO CAMPAIGNS sum up to 100%. I want, naturally, each bar to sum up to 100% as to be able to measure a campaign hitrate. How do I do to make this happen? Obviously the "relative" checkbox in the Expression dialogue doesn't do the trick.

I use COUNT(distinct cus_No) to count my customers.

Best regards,

Niklas

3 Replies
Not applicable
Author

Hi Niklas, what you need to do is to use something like

COUNT(FIELD) / COUNT (TOTAL FIELD) to get the percentage. Let's assume you have
A=10
B=40
C=50

Then you would get 10%, 40%, 50%.

Now if you want to achieve the same thing but add a time dimension your formula would look like

COUNT(FIELD) / COUNT ( TOTAL <DATEFIELD> FIELD) then it would give you the share just for a paticular date (you can use any other dimension of course too).

Hope this helps.

Lukas

Not applicable
Author

Hello, and thank you for your answer.

Unfortunately, the TOTAL qualifier doesn't work for me. It seems like what it does is take the number of customers with a certain response and divides it with the total amount of customers overall.


What I'm trying to accomplish is to divide the number of customers w/ a certain response with the number of customers in that particular campaign. How do I do that?

Best regards,

Niklas

sparur
Specialist II
Specialist II

may be this expression will be resolve your problem:

count({<Response = {"YES"}>}distinct CustNo) /count(distinct CustNo)