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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
hammermill21
Creator III
Creator III

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
sunny_talwar
MVP
MVP

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

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

View solution in original post

12 Replies
sunny_talwar
MVP
MVP

What are you getting right now?

hammermill21
Creator III
Creator III
Author

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

sunny_talwar
MVP
MVP

Seems like problem with parenthesis...

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

hammermill21
Creator III
Creator III
Author

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

Capture12.PNG

sunny_talwar
MVP
MVP

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

hammermill21
Creator III
Creator III
Author

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

sunny_talwar
MVP
MVP

Can you share the expressions for Pending and Inventory?

hammermill21
Creator III
Creator III
Author

Inventory:

=Count({1}DISTINCT BarcodeI)

Pending:

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

sunny_talwar
MVP
MVP

So what you really want is this

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