Solved

metric not available

  • 30 March 2022
  • 5 replies
  • 77 views

  • New Participant
  • 2 replies

Hello,

I have created a simple metric (just a simple logic between attribute and fact). The Metric is available in the `Analyze` section along other facts and attributes.

However if I try to construct f.e. `Line chart` and drag this metric to `Metrics` section, all other attributes disappear and I’m unable to use them (f.e. I’m unable to `Trend by` Date, etc...). 

Also, if I first try to `Trend by` Date, the added metric disappears from the available data and I see the warning `1 unrelated data item hidden`. 

Obviously, somehow the metrics are not connected with other data - how can I please achieve that? Haven’t found any relevant posts about that in the docs nor the community…

Thanks.

icon

Best answer by Jan Kos 31 March 2022, 20:57

View original

5 replies

Userlevel 1

Hi Jan,

If I understand it correctly you want to build metric, which would express “Netto” fact as positive value for every record, is that correct?

In that case building metric with absolute value function should be sufficient - e.g. SELECT ABS(Netto)

Let me know if that helps

-Jan

 It’s pretty simple:

The “Typ” is either “issued” or “received”. The “Netto” is positive in the case of “issued” and negative in the case of “received”. Trying to build a simple metric, which will be positive for all records.

 

What I tried so far:

SELECT Sum(IF Typ = "issued" THEN Netto ELSE -Netto END) by Date (Datum)

SELECT IF Typ = "issued" THEN Netto ELSE -Netto END

SELECT Sum(IF Typ = "issued" THEN Netto ELSE -Netto END)

SELECT IF Typ = "issued" THEN Sum(Netto) ELSE Sum(-Netto) END by Date (Datum)

etc…

 

Basically anything which “could” work, even some nonsense :)

Thank you for your help!

Jan

Userlevel 1

Can you provide a code snippet how is your metric defined? Can you post screenshot of your LDM with objects used in the metric?

When you are adding fact in to “Metric” section in analytical designer, SUM function is automatically applied and can be changed to different function (AVG, MIN, MAX, etc.). When you are adding metric in to “Metric” section, the function is already defined in the metric definition.

Hi Jan,

It depends how is your LDM build and how are your datasets connected. If your metric is build under certain dimension, objects which aren't related to this dimension disappear from the list of available objects. Feel free to check following community post as an example:
 

To get around this, “Explicit lifting” feature using BY clause can be used when building metric. BY keyword locks the aggregation level at an attribute that would otherwise not be able to slice a particular metric. More information information in the following article:
https://help.gooddata.com/classic/en/dashboards-and-insights/maql-analytical-query-language/maql-use-cases-and-tutorials/explicit-lifting

-Jan

Thanks, tried to go through and apply some hints, but it didn’t help. Still the same behavior. One more thing I noticed - for facts, once dragged to Line chart metrics, the “Sum of “ that fact appears automatically, which is not the case for custom metric….

Any more clues please?

Userlevel 1

Hi Jan,

It depends how is your LDM build and how are your datasets connected. If your metric is build under certain dimension, objects which aren't related to this dimension disappear from the list of available objects. Feel free to check following community post as an example:
 

To get around this, “Explicit lifting” feature using BY clause can be used when building metric. BY keyword locks the aggregation level at an attribute that would otherwise not be able to slice a particular metric. More information information in the following article:
https://help.gooddata.com/classic/en/dashboards-and-insights/maql-analytical-query-language/maql-use-cases-and-tutorials/explicit-lifting

-Jan

Reply