Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

hammermill21
Contributor II

Calculating Percentages

Hello,

I am trying to get the percentages of pending items.

so I have an inventory count of 36, 0 pending so it'a 0% pending, but for some reason, I'm not always getting the right totals. This is what I have tried:

=Count({1}DISTINCT BarcodeI) / (Count({1}DISTINCT BarcodeI)) - (Count(DISTINCT{<Pass= {'YES'}, Barcode>} Barcode) )/100

I must be missing something in my expression.

Thank you!

1 Solution

Accepted Solutions
MVP
MVP

Re: Calculating Percentages

Oh, then why don't you just use this?

=(Count({1}DISTINCT BarcodeI) - Count(DISTINCT{<Pass= {'YES'}, Barcode>} Barcode))/Count({1}DISTINCT BarcodeI)

12 Replies
MVP
MVP

Re: Calculating Percentages

What are you getting right now?

hammermill21
Contributor II

Re: Calculating Percentages

Hey Sunny,


So right now for items that are inventory count 356 and 0 are pending I get -256%, but if it's inventory count 194 and pending 188 I get the correct answer of % Pending 94%.





Capture11.PNG

MVP
MVP

Re: Calculating Percentages

Seems like problem with parenthesis...

=Count({1}DISTINCT BarcodeI)/(Count({1}DISTINCT BarcodeI) - Count(DISTINCT{<Pass= {'YES'}, Barcode>} Barcode))/100

hammermill21
Contributor II

Re: Calculating Percentages

Right that makes sense, but still, the totals aren't all correct:

Capture12.PNG

MVP
MVP

Re: Calculating Percentages

Sorry, but which totals are we talking about? I am a little confused

hammermill21
Contributor II

Re: Calculating Percentages

I'm sorry!

So for the line item Exit light which is:

Inventory = 356 and Pending = 0 the % Pending is - which is correct

But for the line item Fire Extinguisher:

Inventory= 173 and Pending = 1, the % Pending is 173% which is incorrect

MVP
MVP

Re: Calculating Percentages

Can you share the expressions for Pending and Inventory?

hammermill21
Contributor II

Re: Calculating Percentages

Inventory:

=Count({1}DISTINCT BarcodeI)

Pending:

=Count({1}DISTINCT BarcodeI) - Count(DISTINCT{<Pass= {'YES'}, Barcode>} Barcode)

MVP
MVP

Re: Calculating Percentages

So what you really want is this

=(Count({1}DISTINCT BarcodeI) - Count(DISTINCT{<Pass= {'YES'}, Barcode>} Barcode))/Count({1}DISTINCT BarcodeI) * 100

Community Browser