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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis/filter problem

Hi

I am trying to calculate an average lead time per stock no and exclude the outliers (values under the 25th percentile and values over the 75th percentile).  
Thanks to this community I was able to construct/refine my formula which is working.  However there seems to be some behaviour which I do not understand.  
The "Avg. lead time (excl. outliers)" contains the following expression:  

"=avg(

total <[Stock no]>

{<[Lead time (days)]={"">=$(=fractile(total<[Stock no]> [Lead time (days)],$(Percentile_Min))) <=$(=fractile(total<[Stock no]> [Lead time (days)],$(Percentile_Max)) )""}>}

[Lead time (days)])"  

When the model is filtered to a specific stock no the table below shows the expected (CORRECT) results.  On this occasion 98 is the 25th percentile and 128 is the   

75th percentile and the expression is averaging 98, 100 and 128 as they fall within the criteria.  The values 132 and 70 are excluded which is what I want.  
  
   filtered.png
  
However, when the model is unfiltered and although the percentile values remain unchanged, the expression seems to interpret the lead time values differently   
and as a result, it is excluding the 128 lead time.  It is only averaging the 98 and 100 returning a result of 99…?  
   unfiltered.png
  
Can anyone tell me why and better still suggest a solution?  
  
Many thanks  

Oli

5 Replies
sunny_talwar

I am not an expert, so experts, correct me if I am wrong, but set analysis take a single value for the chart and hence when you have not selected on stock no, it may be calculating a Fractile number based on all the stock no. I would have asked you to use aggr, but it doesn't work within set analysis because of the same reason that set analysis takes a single value for a chart. The only solution I can think of is to calculate 25th and 75th Fractile in the script using group by statement and then use that in your chart.

Hope that helps.

Best,

S

Not applicable
Author

Thanks for the reply

Sadly I can not get this to work in the script. So I am not sure if there is a solution for my problem??

Oli

sunny_talwar

You don't have access to the script or you are not sure how to do this within the script? If you can share some dummy data, I may be able to help you.

Best,

S

Not applicable
Author

I have access to the script but I am not sure I can load an example easily due to the models size and complexity.  I will see what I can come up with.

Thanks again.

sunny_talwar

Not a problem. Hope you are able to achieve what you are trying to do.

Best,

S