Konstantin Krumin
03/13/2024, 5:05 PMSELECT
"PassportCountries"."passportCountry",
AVG("AssessmentsView"."totalRiskScore") AS "average_risk_score"
FROM
"PassportCountries"
JOIN
"AssessmentsView" ON "PassportCountries"."id" = "AssessmentsView"."id"
GROUP BY
"PassportCountries"."passportCountry";
However, for some reason when I create a new metric in GoodData using something like SELECT AVG({fact/assessmentsview.totalriskscore})
or SELECT AVG({fact/assessmentsview.totalriskscore}) BY {dataset/passportcountries}
and trying to input this average score metric and relate it to the Passportcountry field, I don't seem to find it there. After I drop in the Average Risk Score metric, the search only allows me to select fields from the same table where the Totalriskscore comes from, like I can create a visualization mapping lastname field to average risk score (which are both in the same table), but I don't seem to be able to map to Passportcountry (a field that comes from that other table)
Is there any way to achieve this inside GoodData?Konstantin Krumin
03/13/2024, 5:07 PMFrancisco Antunes
03/13/2024, 5:21 PMPassportcountries
by the attributes in Assessmentsview
, when it should be the other way around.
The article I just linked explains how to properly set up the relationships - make sure that the arrow in the Data Model points from Passportcountries
to Assessmentsview
and you should be able to build the insight you described (the metric/MAQL is built perfectly, btw 🙂 )Konstantin Krumin
03/13/2024, 6:14 PM