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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count total divide by value

What would be the best approach for what I'm looking for, script or expression?

I have a pivot chart, below.

I need to count the total PK then divide by when Reason = Yes

End goal:

% of Reasons from total PK counts.

Example

Count of PK -   100

Count of Reason - 25

25/100 = 25%

----------------------------------------------------------------

                            

COUNTY           YEAR         2016                2015           2014

Singleton                               

Parry

Luck

Luke

Values

PK

Year

County

Reason

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Yes, simple enough.

count({<REASON = {'Yes'}>}PK)/count(PK)

View solution in original post

3 Replies
sunny_talwar

Not sure I understand

Count(PK)/Count(Reason)?

Not applicable
Author

I'm having trouble following your example but I'll give it a shot.  I'm going on the assumption that you are looking for a pivot table with two dimensions COUNTY and YEAR and you need a expression that is count of PK over Count of Reason where reason = Yes. 

your expression would be

COUNT(PK)/SUM(IF(Reason='Yes',1,0))

If I'm not following right please post an excel or QVW that demonstrates what you want. Even if the results are wrong it will help color a picture and you can point out where it is wrong.

Anonymous
Not applicable
Author

Yes, simple enough.

count({<REASON = {'Yes'}>}PK)/count(PK)