Syntax of the MROUND function
The MROUND function in DAX has the following syntax:
- `❰number❱`: This is the number that you want to round to the nearest specified multiple.
- `❰multiple❱`: This is the value that you want to round to. The `❰number❱` argument is rounded to the nearest multiple of this value.
Examples of Using the MROUND Function in Power BI
Example 1: Rounding to the nearest dollar
Suppose you have a dataset that contains sales data for a particular store and you want to round the sales figures to the nearest dollar. You can achieve this by using the MROUND function as follows:
= MROUND(Sales[Amount], 1)
This formula will round the `Amount` column in the `Sales` table to the nearest dollar.
Example 2: Rounding to the nearest thousand
Suppose you have a dataset that contains data on employee salaries and you want to round the salaries to the nearest thousand dollars. You can achieve this by using the MROUND function as follows:
= MROUND(Employee[Salary], 1000)
This formula will round the `Salary` column in the `Employee` table to the nearest thousand dollars.
Example 3: Rounding to the nearest 0.5
Suppose you have a dataset that contains data on stock prices and you want to round the stock prices to the nearest 0.5. You can achieve this by using the MROUND function as follows:
= MROUND(Stock[Price], 0.5)
This formula will round the `Price` column in the `Stock` table to the nearest 0.5.
The MROUND function in DAX is a powerful tool that can be used to round a given number to the nearest specified multiple. It can be especially useful when dealing with financial data or when performing calculations that require a specific level of accuracy. In this article, we have explored how to use the MROUND function in Power BI and provided some examples to demonstrate its capabilities. With this knowledge, you can now use the MROUND function to round numbers in your own Power BI projects.
Power BI DAX Training Courses by G Com Solutions (0800 998 9248)
Power BI DAX Intensive Training Course£1,050.00 – £26,550.00
Power BI DAX Introduction£395.00 – £9,750.00
Power BI DAX Intermediate£395.00 – £9,750.00
Power BI DAX Advanced£395.00 – £9,750.00