Tutorial with example
In today’s DAX Fridays video I will show you how to round time, prices and numbers using ROUND, ROUNDUP, ROUNDDOWN, INT, TRUNC, ODD, EVEN, MROUND, FLOOR and CEILING. Rounding numbers, time and prices is a very useful skill as it will give you more control of your dataset and the accurancy in which your numbers are presented.
We are going through the functions in this order:
01:01 Round to the nearest number with ROUND
02:37 Round up to the nearest number with ROUNDUP
03:16 Round down to nearest number with ROUNDDOWN
04:11 Round down prices to the nearest integer with INT
05:00 Remove decimals from the number with TRUNC
05:48 Round up to the nearest odd number using ODD
06:11 Round up to the nearest odd number using ODD
07:43 Round prices to the nearest 0.05 of a euro cent with MROUND
08:58 Round down prices to the nearest 0.05 of a euro cent with FLOOR
09:23 Round up prices to the nearest 0.05 of a euro cent with CEILING
10:56 Round time to the nearest hour with MROUND
11:45 Round up time to the nearest 15 minutes with CEILING
12:31 Round down time to the nearest 15 minutes with FLOOR
Download example file:
Link to Power BI file: here.
- TRUNC and INT are similar in that both return integers. TRUNC removes the fractional part of the number. INT rounds numbers down to the nearest integer based on the value of the fractional part of the number. INT and TRUNC are different only when using negative numbers:
TRUNC(-4.3)returns -4, but
INT(-4.3)returns -5 because -5 is the smaller number.