Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis - percentage calculation

Hi all,

I have a question for you regarding the problem that happens me occasionally while I use set analysis.

Set analysis:

% of late deliveries:

count({$<[delivery status]={"LATE"}>} [DELIVERY NOTE UNIQUE ID])/(Count([DELIVERY NOTE UNIQUE ID]))*100

% of deliveries on time:

count({$<[delivery status]={"ON TIME"}>} [DELIVERY NOTE UNIQUE ID])/(Count([DELIVERY NOTE UNIQUE ID]))*100


Delivery note can have 2 statuses: ON TIME or LATE (there is no third possibility).


This analysis shows correct results in all cases, expect for one. In the case when I select either filter "ON TIME" or "LATE", I get calculated % values that are above 100%, or the sum of these two values is higher than 100% (what is not expected).


Have other people faced situation that % value calculated with set analysis is higher then 100%, and how you resolved it?


Regards

Vera

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

My last try. If this will not work.. I need sample data.

=Num(count({$<[delivery status]*={"LATE"}>} [DELIVERY NOTE UNIQUE ID])/(Count({<[delivery status]*={"ON TIME","LATE"}>}[DELIVERY NOTE UNIQUE ID])),'#0.0%')

and

=Num(count({$<[delivery status]*={"ON TIME"}>} [DELIVERY NOTE UNIQUE ID])/(Count({<[delivery status]*={"ON TIME","LATE"}>}[DELIVERY NOTE UNIQUE ID])),'#0.0%')

View solution in original post

14 Replies
MK_QSL
MVP
MVP

Try

count({$<[delivery status]={"LATE"}>} [DELIVERY NOTE UNIQUE ID])

/

(Count(Total [DELIVERY NOTE UNIQUE ID]))*100


and


count({$<[delivery status]={"ON TIME"}>} [DELIVERY NOTE UNIQUE ID])

/

(Count(Total [DELIVERY NOTE UNIQUE ID]))*100

swuehl
MVP
MVP

You probably need to ignore the selection in field [delivery status] in the denominator:

for example:

=count({$<[delivery status]={"LATE"}>} [DELIVERY NOTE UNIQUE ID])

/

(Count({<[delivery status] = >} [DELIVERY NOTE UNIQUE ID]))

*100

Not applicable
Author

Thank you very much for proposal. Unfortunately, the problem with %>100% still occurs.


Regards
Vera

MK_QSL
MVP
MVP

or

=Num(count({$<[delivery status]={"LATE"}>} [DELIVERY NOTE UNIQUE ID])/(Count({<[delivery status]>}[DELIVERY NOTE UNIQUE ID])),'#0.0%')

and

=Num(count({$<[delivery status]={"ON TIME"}>} [DELIVERY NOTE UNIQUE ID])/(Count({<[delivery status]>}[DELIVERY NOTE UNIQUE ID])),'#0.0%')

Updated : Before me Stefan has already replied. ..

Not applicable
Author

Hi, thanks for proposal.


Now during selection of filter ON TIME/LATE doesn't affect set analysis. All other filters work normally. Is there a way to update set analysis formula so it can be sensitive to selection of DELIVERY STATUS FILTER (ON TIME/LATE), while it shows correct results (100% or 0% for selection of one of the filtration criteria)?

Thanks

Vera

MK_QSL
MVP
MVP

=Num(count({$<[delivery status]*={"LATE"}>} [DELIVERY NOTE UNIQUE ID])/(Count({<[delivery status]>}[DELIVERY NOTE UNIQUE ID])),'#0.0%')

and

=Num(count({$<[delivery status]*={"ON TIME"}>} [DELIVERY NOTE UNIQUE ID])/(Count({<[delivery status]>}[DELIVERY NOTE UNIQUE ID])),'#0.0%')

eniemenm
Partner - Contributor II
Partner - Contributor II

By using the set excluding operator minus, you propably achieve what you are looking for:

count({<[delivery status] -= {'ON TIME'}>}[DELIVERY NOTE UNIQUE ID]) / count([DELIVERY NOTE UNIQUE ID]) * 100

This way you can exclude results related to delivery status "on time" but if "on time" is selected, it wont give the results related to "late".

Not applicable
Author

Hi Eerno,

It seems we are close, but not exactly at the right place. After adding  set excluding operator minus, when I select "on time" filter, I get 0% for on time and correct number for "late" (and vice versa).

Is there some operator that excludes everything but selected value?


Thank you all on your help!


Regards

Vera

eniemenm
Partner - Contributor II
Partner - Contributor II

If you wish it to show always the selected from field [delivery status] divided by the total you could use this formula:

count[DELIVERY NOTE UNIQUE ID]) / count({<[delivery status] >}[DELIVERY NOTE UNIQUE ID]) * 100

If this is not what you are looking for, it might help if you provided some examples on how you would expect it to work 😃