Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Make a Chart Box divide by the monthly total.

I currently have a code written that identifies customers on the basis of their credit rating and what month they became a client.  The chart box then regurtitates the number of customers for each of our five categories on a monthly basis.  However, now I need it do the same but take the number in each category and divide it by the total number of customers in that month.  What I like to be able to do is simply have each number divide by the expression total I  have added as the bottom row.  Any ideas?

The code I just tried looks like this, but gives me a result of 0:

count({1<Acct_CCDMonth = {1}, Acct_CCDYear = {$(vThisYear)}>} Acct_Pre_Screen_Black)/count(TOTAL<{1<Acct_CCDMonth = {1}, Acct_CCDYear = {$(vThisYear)}>} Acct_Pre_Screen_Black> {1<Acct_CCDMonth = {1}, Acct_CCDYear = {$(vThisYear)}>} Acct_Pre_Screen_Black)

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Have you tried this?

=count({1<Acct_CCDMonth = {1}, Acct_CCDYear = {$(vThisYear)}>} Acct_Pre_Screen_Black)

/count({1<Acct_CCDMonth = {1}, Acct_CCDYear = {$(vThisYear)}>} TOTAL Acct_Pre_Screen_Black)

View solution in original post

4 Replies
swuehl
MVP
MVP

Hi,

I believe you shouldn't put the set expression within the TOTAL<fields>, so maybe change it to

=count({1<Acct_CCDMonth = {1}, Acct_CCDYear = {$(vThisYear)}>} Acct_Pre_Screen_Black)

/count({1<Acct_CCDMonth = {1}, Acct_CCDYear = {$(vThisYear)}>} TOTAL<Acct_Pre_Screen_Black> Acct_Pre_Screen_Black)

What are your dimensions in your chart? I assume the first part of your division calculates successfully to a number?

Regards,

Stefan

Not applicable
Author

I say what you are saying, but that results in all 1's.  Basically that makes it so each of the five categories divideds by the total of itself, I need it to divide by the sum of all.  And yes, if I eliminate the division, I get a number.  That is how this report began but now we are more interested in the numbers as a % of the total.

swuehl
MVP
MVP

Have you tried this?

=count({1<Acct_CCDMonth = {1}, Acct_CCDYear = {$(vThisYear)}>} Acct_Pre_Screen_Black)

/count({1<Acct_CCDMonth = {1}, Acct_CCDYear = {$(vThisYear)}>} TOTAL Acct_Pre_Screen_Black)

Not applicable
Author

Thanks, funny how the simplest measure is so often the solution.  I didn't realize you could utilize total without a <field> expression.