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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
apnydsny516
Contributor
Contributor

How to get percentage from a single column of choices

Hi

I have a column list called total count of about 6,000 entries that have different options like cancelled, closed, n/a.  

I want to generate a formula to show in a kpi view that shows out of the 6,000 what is the percentage of cancelled.

 

So for example if 5,000 are called cancelled out of the 6,000 i need to represent that in a percentage of that total

 

Labels (2)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Num(
count({<[Rescheduled/Mail In/Cancelled]={"cancelled"}>}[Rescheduled/Mail In/Cancelled])
/ count(
[Rescheduled/Mail In/Cancelled])
, '#,#0%')

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

9 Replies
Anil_Babu_Samineni

Perhaps this?

Num(<Expression for 5000>/<Expression for 6000>, '#,#0%')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
apnydsny516
Contributor
Contributor
Author

thank you....what i need to do first though is figure out how many cancelled there are?  How would I do that?

apnydsny516
Contributor
Contributor
Author

Here is what i got so far but it is not working

 

Num(<Sum(if([Rescheduled/Mail In/Cancelled]like 'cancelled',1,0))>/<Count([Rescheduled/Mail In/Cancelled])>, '#,#0%')

 

 

Anil_Babu_Samineni

Let's say your expression as follows you can restrict them, M1 and M2 are the measure fields

Num(Sum({<Status={'Cancel'}>} M1)/Sum({<Status={'Cancel'}>} M2), '#,#0%')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
apnydsny516
Contributor
Contributor
Author

Did you see what i currently have.  Am i missing something in this formula as it is not working?  Thank you.

Num(<Sum(if([Rescheduled/Mail In/Cancelled]like 'cancelled',1,0))>/<Count([Rescheduled/Mail In/Cancelled])>, '#,#0%')

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Num(
count({<[Rescheduled/Mail In/Cancelled]={"cancelled"}>}[Rescheduled/Mail In/Cancelled])
/ count(
[Rescheduled/Mail In/Cancelled])
, '#,#0%')

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

Anil_Babu_Samineni

Perhaps this

Num(Sum(if(Match([Rescheduled/Mail In/Cancelled], 'cancelled',)1,0))/Count([Rescheduled/Mail In/Cancelled]), '#,#0%')

I don't understand what you are trying in red part? I think you are new user for Qlik, I would suggest to read more from help pages and set analysis. https://help.qlik.com/en-US/sense/September2020/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/use-... 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
apnydsny516
Contributor
Contributor
Author

Ok so that got me a little further.  The query is OK but my results are coming back at 0%.  Thoughts?

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Test each count() expression separately.

-Rob