Recent searches


No recent searches

Calculate median without 0-values

Answered


Posted Jun 29, 2021

I'm trying to get median calculated and it's always returning me 0 as a result. I found out that I have lots of 0 values in my data and I'd like to filter those out of the median calculation?

I can do that in SQL but I couldnt find a way to do that in explore. Is there a way to do it?


0

6

6 comments

Official

image avatar

Dan Borrego

Zendesk Customer Care

When working with metrics, you can always filter it to eliminate the 0 (zero) values on it.

To do it please navigate to Result manipulation>Metric filter 

When you are in the Metric filter, you will be able to move the selector from zero to 1, Which will eliminate all elements that are resulting in zero in your metric

Please note in case you have higher values, and you move for example from 0 to 5 all results lower than 5 will be eliminated.

Please refer to this article to understand better how this will work.

Selecting the metric result range

Hope it responds to your question and feel free to send us any other you may have.

Wish you have a great day!

 

0


Hi,

 

Thanks for the response. I actually tried that already but it didnt work for me. 

I tried it first with data sorted by ticket ID, it worked good. This is result without filtering:

This is result after filtering:

So there it goes well. But when using median without filter it gives me 0

With Filter I'm expecting to see around 2 minutes and 23 seconds but what I see is just blanc white report

 

0


Hi, 

I have the same problem. I want to display a KPI of a median for "Requester wait time" excluding 0 from calculation but it's seems impossible... 

0


image avatar

Dan Borrego

Zendesk Customer Care

Hi @... and @...,

I can confirm this flow won't work for time metrics. 

For those metric, you will need to create a calculated attribute using this formula 

IF (VALUE(Requester wait time (min)) =0)
THEN "0"
ELSE IF (VALUE(Requester wait time (min)) =NULL )
THEN "NULL"
ELSE "OK"
ENDIF ENDIF

Then add this new attribute to Filters in your query and filter out "0" and "null"

It will return the result you expect. If you don't intend to filter out zeros, you can edit that part of the formula and only leaves the Null part of it.

Please feel free to ask any questions you may have.

Hope you have a great week,

 

3


Thanks Daniel, this works great for me!

0


I've noticed the approach of making a calculated attribute works well if your report only has one metric, but doesn't work as well if you have multiple metrics since excluding the 0 values will exclude the entire ticket and therefore exclude it from other metrics. Another approach is to just return a null value for that particular metric by using a calculated metric as shown here: 

 

IF (VALUE(On-hold time - Business hours (min)) = 0)
THEN 
  NULL 
ELSE 
 (VALUE(On-hold time - Business hours (min)))
ENDIF

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post