Dax Function: ROUND

Category: Mathematical and Trigonometric Functions

The ROUND function in Power BI is a DAX function used to round a number to a specified number of decimal places. This function helps ensure numerical consistency, particularly when dealing with financial data or other calculations requiring precision.

Purpose:

The ROUND function is primarily used to:

  • Standardize numeric values to a desired level of precision.
  • Simplify data presentation by eliminating unnecessary decimal places.
  • Ensure precision in calculations for better readability and analysis.

Type of Calculations:

  • Performs rounding to the nearest value based on standard mathematical rounding rules.
  • Supports rounding both up and down depending on the decimal value.

Practical Use Cases:

  1. Financial Reporting: Round currency values to two decimal places.
  2. Simplifying Data: Reduce the complexity of numbers in reports by rounding to whole numbers.
  3. Consistent Precision: Ensure consistent decimal places in calculated measures and visualizations.

ROUND(<number>, <num_digits>)</num_digits></number>

ParameterTypeDescription
numberScalarThe numeric value or expression to round.
num_digitsScalarThe number of decimal places to round to. Can be positive or negative.

How Does ROUND Dax Function Works?

The ROUND function applies standard rounding rules:

  • If the digit after the rounding position is 5 or greater, the value rounds up.
  • Otherwise, the value rounds down.

Mathematical Formula:

Example: For ROUND( 123.456, 2 ):

  1. Look at the third decimal place (6). Since it is greater than 5, round up.
  2. The result is 123.46.


What Does It Return?

The ROUND function returns a numeric value that has been rounded to the specified number of decimal places. If the value of num_digits is:

  • Positive: Rounds to the specified number of decimal places.
  • Zero: Rounds to the nearest integer.
  • Negative: Rounds to the left of the decimal point (to tens, hundreds, etc.).

When Should We Use It?

  • Formatting Data for Reports: Ensure numeric data is rounded to desired decimal places for presentation.
  • Financial Calculations: Standardize currency calculations to two decimal places.
  • General Use: Round numbers to whole integers for better visualization.

Examples

Basic Usage

Round 123.456 to 2 decimal places:


RoundedValue = ROUND(123.456, 2)

Output: 123.46.

Column Usage

Apply rounding to a column containing sales values:


RoundedSales = ROUND(Sales[Amount], 0)

Rounds all sales amounts to the nearest integer.

Advanced Usage

Combine rounding with conditional logic:


ConditionalRounding = IF(Sales[Amount] &gt; 1000, ROUND(Sales[Amount], 0), ROUND(Sales[Amount], 2))

Result: Sales over 1000 are rounded to integers, while smaller amounts are rounded to 2 decimal places.

Tips and Tricks

  • Use ROUNDUP and ROUNDDOWN for Control: If you always need to round up or down, use these functions instead of ROUND.
  • Negative num_digits Values: To round numbers to tens, hundreds, or thousands:
    RoundedToTens = ROUND(1234, -1) // Result: 1230
  • Combine with Formatting: Pair rounding with number formatting for cleaner visuals.

Performance Impact of ROUND DAX Function:

  • Computationally efficient but may add minimal overhead in large datasets with many rounded values.
  • Ensure appropriate precision for critical calculations to avoid rounding errors.

Related Functions You Might Need

  • ROUNDUP: Rounds a number up, regardless of the decimal value.
  • ROUNDDOWN: Rounds a number down, regardless of the decimal value.
  • INT: Truncates the number to its integer part without rounding.
  • TRUNC: Truncates a number to a specified number of decimal places.

Want to Learn More?
For more information, check out the official Microsoft documentation for ROUND. You can also experiment with this function in your Power BI reports to explore its capabilities.

If you’re looking to unlock the full potential of Power BI and take your data insights to the next level, our expert Power BI consulting services are here to help. Whether you need assistance with implementing advanced DAX functions like the ones discussed here, creating interactive dashboards, or optimizing your data models for better performance, our team of seasoned Power BI consultants is ready to provide tailored solutions for your business. Visit our Power BI Consulting page to learn more about how we can empower your organization with data-driven decisions.

1. How does the ROUND function handle negative num_digits values?

Negative num_digits rounds to the left of the decimal point. For example, ROUND(1234,−1) results in 1230.

2. What is the difference between ROUND and TRUNC?

The ROUND function rounds numbers based on standard rounding rules, while TRUNC truncates the number without rounding.

3. Can I use the ROUND function with calculated columns?

Yes, the ROUND function works seamlessly in calculated columns and measures.

4. What happens if num_digits is zero?

The function rounds the number to the nearest integer.

5. How is the ROUND function different from ROUNDUP and ROUNDDOWN?
  • ROUNDUP always rounds up to the next higher value.
  • ROUNDDOWN always rounds down to the next lower value.
  • ROUND follows standard rounding rules.