This is MAQL question more than anything. I’m tryi...
# gooddata-cloud
s
This is MAQL question more than anything. I’m trying to create a metric that can compare the material cost of a product, to the average material cost of all the products in that category. So I have a table and the row would be product name, % material cost, then average material cost of all other products in that category. Is anyone able to point me in the direction of creating the theirs column metric?
j
Hi Sean, We have this legacy article that helps explain how to calculate and compare percentages: https://help.gooddata.com/classic/en/dashboards-and-insights/reports/working-with-tables/calculate-percentage-shares/ Now, the images make look different and the build of the is slightly different in look when using GD Cloud. However, the MAQL logic is the same, and it should help to get your desired results. Also, if you haven’t been to our GoodData University yet, there is a great free course on writing MAQL metrics.
If you get the metric built, but still don’t see your desired results, please let us know and describe what exactly is missing from the insight/report and we can assist further.
j
Let me suggest:
Copy code
SELECT Cost / (SELECT AVG(SELECT Cost BY Product) BY Category, ALL OTHER)