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

cont distinct calculation error

i have a column in my data , is order on time and it has 2 values YES and NO . i need to calculate the % of orders on time per week. i use the formula 

(count(distinct {< [is order on time?] ={"Yes"}>} [order number]))
/
count(distinct [order number]).

In the filter pane i have the filter of is order on time. if i filter on YES, the above formula shows me 100% however if i filer NO, the above formula shows values above 100% which it should actually show as Zero. Any help please on fixing?

 

Labels (3)
2 Solutions

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi 

because you use set analysis , in your first expression :

(count(distinct {< [is order on time?] ={"Yes"}>} [order number]))

selections you make in the field  [is order on time?] , doesn't effect this expression and the result is always as if you selected Yes

change the expressions to this 

(count(distinct if([is order on time?] ='Yes', [order number])))

/

count(distinct [order number]).

View solution in original post

nihar1411
Contributor II
Contributor II
Author

ah indeed. Thanks 🙂

View solution in original post

3 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 

because you use set analysis , in your first expression :

(count(distinct {< [is order on time?] ={"Yes"}>} [order number]))

selections you make in the field  [is order on time?] , doesn't effect this expression and the result is always as if you selected Yes

change the expressions to this 

(count(distinct if([is order on time?] ='Yes', [order number])))

/

count(distinct [order number]).

nihar1411
Contributor II
Contributor II
Author

ah indeed. Thanks 🙂

lironbaram
Partner - Master III
Partner - Master III

Spoiler
hi 

if possible , please mark the answer as correct , so it'll be clear this thread is close