Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
WEBINAR June 25, 2025: Build on Apache Iceberg with Qlik Open Lakehouse - REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Maggie_1
Contributor II
Contributor II

Get percentage of subset

Hey!

I have unfortunately not found an answer to this question yet. I have a dataset that includes products, a product line, and the number of orders (calculated with a count measure). Now I want to know what the percentage of orders is per product per productline. So for example:

Products, Product Line, Number of Orders
Shampoo, Hair, 5
Conditioner, Hair, 10
Mascara, Make-up, 30
Lipstick, Make-up, 50
Eyeshadow, Make-up, 20

Now the conditioner should have a percentage of 66,7% and the Lipstick should be 50%. Anyone an idea of how to do this in the set analysis? I want to show it in a table.

Thanks in advance!

Labels (2)
1 Solution

Accepted Solutions
-SW-
Partner - Creator II
Partner - Creator II

Can you try:
=Sum([Number of Orders])
/
Sum(Total <[Product Line]> [Number of Orders])

 

 

View solution in original post

5 Replies
-SW-
Partner - Creator II
Partner - Creator II

Can you try:
=Sum([Number of Orders])
/
Sum(Total <[Product Line]> [Number of Orders])

 

 

Maggie_1
Contributor II
Contributor II
Author

This doesn't work sadly (says that they expect a ')' ). I'm using a count function to count the number of orders, does that influence it?

-SW-
Partner - Creator II
Partner - Creator II

It shouldnt be missing any ')', and I believe you should be using Sum for this type of calculation ()

Maggie_1
Contributor II
Contributor II
Author

Yeah there's also not any bracket missing so I think it's some general message that it doesn't work.. Also I see I didn't explain this clearly in the post, but the database contains all the orders, so I'm counting the order numbers (sum isn't an option).

I noticed now that it does not work if I use "count(total distinct <[Product Line]> [Orders])", and instead I can use "count(distinct total <[Product Line]> [Orders])" in the count function.

However, the number of orders differs from the true number of orders, so it is still not working properly unfortunately

Maggie_1
Contributor II
Contributor II
Author

Ah I figured out where the difference came from, and it's a small nuance in my own data. Thank you for your solution, it works!