Solved

# Issues with Rounding & Aggregation metric

• 2 replies
• 75 views

• New Participant
• 3 replies

Hello,

I want to calculate the value on each order in a table, then round each value to the nearest 2 decimal place, and then add up all those rounded numbers. But when Aggregate Table Data by SUM I am not getting the same result as the Total for my ROUND metric. It seems the SUM row is rounding and then summing, but the ROUND metric is summing and then rounding, then they're getting different results for the same metric. Can you help me with this? Slice metric1 by attribute2, round sliced metric to two decimal places, then sum the rounded values?

icon

Best answer by Michael Ullock 4 January 2022, 15:01

View original

### 2 replies

Userlevel 1

Hi Elly,

thanks for sending this in - In this case, your metric would look something like this:
`SELECT SUM( SELECT ROUND( (SELECT SUM(Revenue) BY Attribute, ALL OTHER),2))`

Can you please give this a go and let us know how you get on?