The problem I am having is that when the metric is...
# gooddata-cloud
c
The problem I am having is that when the metric is run in this first screenshot there are no issues but when the quoted description column isnt there it is preforming the metric on a summed percentage which is messing with the result
m
Hi Chris, sorry for the delay in getting back to you here - From the details provided, it seems this is expected behavior when removing Quoted Description: the report grain rolls up from line-level to Quote Request level, and your App Discount % is being aggregated as a SUM of line percentages (e.g., 35% + 34% + … = 351%). Best practice is to not sum percentages. Instead, define the discount % as a ratio of totals (weighted %) so it aggregates correctly at any grain. You metric would look something like this:
Copy code
SSELECT SUM({fact/app_discount_amount}) / SUM({fact/quoted_rrp})
WHERE {fact/app_discount_amount} > 0
I believe this should return the correct % whether or not Quoted Description is included.
c
the issues is I only get that discount amount from using the percentage, the percentage is a fact but the amount is a metric
m
Since App Discount % is stored as a fact and the discount amount is only available as a metric, the “351%” behavior happens when the report rolls up aggregates the % fact (it ends up summing line-level percentages). In this case, I would suggest calculating the discount as total discounted amount ÷ total original amount, instead of summing the row-level percentages. Using a metric for discount amount as the numerator and a metric for the base amount (e.g., full price / quoted RRP) as the denominator, and format the result as a percent. This should aggregate correctly whether or not the line-level attribute (Quoted Description) is in the report or not.