Replace "no data" with "0" in a dashboard

Hi @DavidFearns , I had a chance to check and the default(0) should replace missing data with 0 so calculations can actually take place. For a Table or Single value visualization, make sure you are selecting the fold transformation that fits your needs, the Auto might not yield the expected results.

I am showing below a made up example where there is no intersecting data yet the calculations are taking place thanks to the default(0) and selecting Average for the fold transformation.

@fcourbon anyway we still need to have a transformation to set default value even if there is no data point. Just when displaying any counter.  Try to explain it to the management, they are seeing “No data” instead of 0 on the dashboard.

It applies even for the builtin metrics, for example reporting the application errors:

builtin:apps.mobile.reportedErrorCount
:filter(and(or(in("dt.entity.mobile_application",entitySelector("type(mobile_application),entityName.equals(~"easyTravel Mobile (mainframe)~")")))))
:splitBy()
:sum
:default(0)

Just look at this thread for examples of other situations. There is definitely a need to force a default value, even there is no datapoint.

@Julius_Loman. I guess both, @fcourbon and I agree. It’s not that we don’t see a “need” for this but that there is two distinct parts to this and not both are equally easy to achieve in terms of effort.

  1. How do you display a result for simple metrics (table, single value) that’s something we can provide in the Data explorer and should fix most likely the majority of cases? E.g, have an input field saying "default.. " that allows you to put whatever, for example, “$”.
  2. How do you display a result of metric expression? Here we need @fcourbonbecause we can’t solve this in the Data explorer

for 1, however, there is still one central question: Where would any such default make the most sense to be set?

  • For each tile in the Data explorer? (flexible but tedious if you need to do this often)
  • Or, on a dashboard level (fast but very limited for different metrics)

@zietho My two cents:

  1. Input field is OK for the Data Explorer common use case and easy to use by non Dynatrace experts. In most situations I would just put zero (0) , maybe dash (-) - just for displaying.
  2. If possible, I would just enrich the :default transformation with an optional parameter to force the value even if there is no datapoint. For example: :default(0, force) or something like that. This would solve also 1) unless you want to display non-numeric value.

I would not try to solve it on a dashboard level and leave it to an individual data explorer tile.

Totally agree with @Julius_Loman use cases.

I would add that in a supervision logic, it is painful to see a host or a tile disappear because the datasource is temporarily unavailable.

While I understand the approach you are putting forward, let’s look at it from a customer-centric response.  We, the Dynatrace Community, are telling you that there is a need for no data = 0.  In my case, when designing an executive dashboard, I would want the data across the dashboard to be uniform and show zero with a green indicator instead of “no data” which makes it honestly look like Dynatrace isn’t working.   Please reconsider the approach.

Hey @EnriqueOriol ,

I think that @WesL’s and @arora138 's use cases are very valid and I can relate to both pretty well.

I now also understand your explanation on the difference between data points with NULL values and no data point at all, and the difficulties that a “no data point” brings to the application of a default(0) operator, for example.

However, the need still stands.

The executives that @WesL mentioned still need some neat to handle this.

And I think the term “handle” is really the best one on this case: we get it that “this is how metrics are intended to work”, but what if “how metrics are intended to work” do not solve the Users needs?

When a program spits out an Exception, it’s not the end of the world… we just need to figure out a way to handle it :slightly_smiling_face:

Some suggestions will follow:

  1. In the case of a Single Value data explorer, wouldn’t it be simple to just interpret a null value = no data point at all = zero ? Again, it should be optional and could even be an option specific to the Single Value chart, or others that to not require to show timestamps on data points (eg. top list, table, etc). It would be more natural to a regular (not proficient) user (like an executive): “start at zero and then sum up from there”.
  2. In visualization that need to show data points (eg. graph), the default operator could be a bit more advanced, with the addition of just one parameter: frequency. So, something like :default(0,1m) would “create”/“simulate” ‘fake’/‘dummy’ datapoints, with the frequency of 1 minute with the default value of 0, whenever the metric didn’t show any data points on the timeframe. NOTE: these ‘fake’/‘dummy’ datapoints wouldn’t be stored anythere… would just need to be rendered in the visualization, to fill in gaps and show the desired zeroes whenever need be.

Just two ideas!

Maybe the best solution is something completely different: and I’m 100% fine with it.
What I defend the most is that we do not settle at “this is how metrics are intended to work”, because sometimes users need something that goes beyond how something was intended to work… that’s what makes us evolve :slightly_smiling_face:

Hi @PedroDeodato , the problem is that, if we don’t have any data for the given timeframe, displaying a zero instead of a “No data” message might be misleading because there’s no guarantee that your query is really valid.

I mean, taking @arora138 example (built-in metric with some filter that returns no data for the whole selected period). In that case we are basically getting no results from our database. We can display an array of zeros and it would be meaningful for you, for sure, but… imagine the same query with a typo in the filter. In that case, we will get as well, no results from the database, but I don’t think an array of zeroes would make any sense in this specific scenario. On the contrary, you would probably want to know that something is wrong.
As a workaround for your concrete scenario @arora138, you can always use a calculated metric to make sure you are displaying zeroes, as long as the aggregated metric is always ingesting data from at least one host. However, you will be in the situation explained before, if there’s a typo in the filter value you write, we will not know.

I mean, you can do
( (built-in:metric * 0) + built-in:metric:filtered:auto:default(0) ).
The :auto:default(0) here provides you with zeroes matching the first metric, so the calculation can be executed.

G.e. 
(builtin:kubernetes.pods:splitBy()*0 + builtin:kubernetes.pods:filter(and(or(eq(“k8s.cluster.name”,your-filter)))):auto:default(0)):sort(value(auto,descending)):limit(10)

Best aligned on this links:

https://community.dynatrace.com/t5/Dynatrace-product-ideas/Data-Explorer-Change-No-Data-for-calculated-metric-counts-to/idi-p/185918

Guess the best approach:

“… would just enrich the :default transformation with an optional parameter to force the value even if there is no datapoint. For example: :default(0, force) or something like that …”

https://community.dynatrace.com/t5/Dynatrace-product-ideas/Data-Explorer-Change-No-Data-for-calculated-metric-counts-to/idc-p/195506/highlight/true#M32951

You can now use defualt(0,always) 
Use the metric selector (Data Explorer Advance) to use it. - it has to come after a splitby()

Doc: Metrics API - Metric selector — Dynatrace Docs

@Tom_Eaton is there something similar available for DQL in Grail ?

Hello @cabeywardhana,

Yes there is! We can use a combination of the nonempty and default parameters. See the below screenshot from the documentation:

Thank you for the quick reply Tom.  I have tried your solution and my scenario looks a bit different.  
I have asked a new question here for my scenario. Thank you again.

With this :default(0,always), i got this message

“The :default operator could not be applied as it requires at least one written data point for the metric in the query timeframe.Consider adding the `always` parameter (for example, `:default(0, always)`)”

I have to set this :default(0, Always)