How do we truncate the result of $avg function for example to certain decimal digits?

Did not find any direct function which allows me to truncate the decimal output to certain digits


If you want to truncate to one decimal, you could multiply the average by 10, then apply $trunc to the result and finally divide by 10. For example, assume your average is 7.369442. After multiplying by 10 you would get 73.69442, which would become 73 after truncation. If we now divide by 10, we would get our final result, which is 7.3.

Hope this helps.

José Carlos

1 Like