Spot Poor Power BI Reports: No3. No Units Calculation Group

When working with large datasets in Power BI, displaying big numbers—especially those over a million—can become a challenge. Lengthy figures not only clutter your visuals but can also confuse your audience. To enhance readability and comprehension, it’s essential to format these numbers into thousands, millions, or even billions. While Power BI offers several methods to achieve this, not all are optimal.

In this article, we’ll explore the various approaches to handling large numbers and show why implementing a “Units Calculation Group” is often the best solution.

Common Approaches to Displaying Large Numbers

There are several strategies you might consider when formatting big numbers in Power BI:

  1. Automatic Formatting by Visuals
  2. Fixing the Visual to a Specific Unit
  3. Using a Helper Table in Measures
  4. Implementing a Units Calculation Group

1. Automatic Formatting by Visuals

Letting the visual handle the formatting automatically seems convenient. However, Power BI’s automatic unit selection can sometimes be suboptimal. You might find your visuals displaying “0” or “1 million,” which lacks the necessary detail, especially without decimal places.

2. Fixing the Visual to a Specific Unit

Manually setting the unit (e.g., thousands, millions) in the visual’s format settings can work, but it locks you into one unit. This rigidity doesn’t accommodate data that spans multiple scales, limiting the flexibility of your report.

3. Using a Helper Table in Measures

Adding a helper table and integrating it into your measures offers more control but increases complexity. This method can clutter your model and make maintenance more challenging, especially as your data evolves.

Why Implement a Units Calculation Group?

Given the limitations of the previous methods, implementing a Units Calculation Group is often the most effective solution. This approach provides flexibility and precision, allowing you to display numbers in the appropriate units with the desired level of detail.

Benefits of Using a Units Calculation Group in Combination with Dynamic Format String

  • Dynamic Unit Selection: Users can switch between units (e.g., thousands, millions) as needed.
  • Enhanced Readability: Proper formatting with decimal places improves data comprehension.
  • Consistency: All relevant measures are automatically included.

Tips for Implementing a Units Calculation Group

To ensure your Units Calculation Group works effectively, consider the following tips:

  1. Default Measure Display: The option for the actual measure without any selection (SELECTEDMEASURE()) isn’t necessarily needed. If no unit is selected, the actual measure will display by default.
  2. Exclude Text Values: Use ISNUMBER(SELECTEDMEASURE()) to exclude text measures from the calculation group, preventing errors.
  3. Exclude Percentage or Ratio Measures: Apply a condition like NOT(CONTAINSSTRING(SELECTEDMEASURENAME(), “%”)) to exclude percentage or ratio measures that shouldn’t be scaled.
  4. Use Dynamic Formatting Strings: Implement dynamic formatting to add decimal places for millions but not for thousands or when no unit is selected. This enhances precision where needed without cluttering smaller numbers. See below for DAX code.
  5. Display Selected Unit in Titles: Incorporate the selected unit into your visual titles or within the dynamic formatting string. This provides context to users about the scale of the numbers they’re viewing.

Below is the full definition of the calculation item for “Thousand.” You can adapt this for the “Million” calculation item by adjusting the divisor.

IF(
    ISNUMBER(SELECTEDMEASURE()),
    IF(
        NOT(
            CONTAINSSTRING(SELECTEDMEASURENAME(), "%") ||
            CONTAINSSTRING(SELECTEDMEASURENAME(), "ratio")
        ),
        DIVIDE(SELECTEDMEASURE(), 1000),
        SELECTEDMEASURE()
    ),
    SELECTEDMEASURE()
)

Explanation of the Code

  • ISNUMBER(SELECTEDMEASURE()): Checks if the measure is a number to exclude text values.
  • NOT(CONTAINSSTRING(…)): Excludes measures that contain “%” or “ratio” in their names.
  • DIVIDE(SELECTEDMEASURE(), 1000): Scales the measure down to thousands.
  • SELECTEDMEASURE(): Returns the original measure if conditions are not met.

SWITCH(
    SELECTEDVALUE( UnitCalcGroup[Unit] ),
    "NameOfCalcItemThousand", "0,#",
    "NameOfCalcItemMillion", "#,0.#",
    "#,#"
)

To dynamically display the selected unit in your visual titles, use the following DAX expression and combine it with static text

SELECTEDVALUE(UnitCalcGroupName[Unit])

This expression retrieves the currently selected unit from your Units table, allowing you to inform users about the scale directly within the visual.

Conclusion

Optimizing the display of large numbers in Power BI reports is crucial for clarity and professionalism. While multiple approaches exist, implementing a Units Calculation Group offers the most flexibility and control. By following the tips outlined above, you can enhance your reports, making them more informative and user-friendly.

Remember, the goal is to present data in a way that is both accurate and easily digestible. With the right formatting techniques, your Power BI reports will not only look better but also provide greater value to your audience.

Leave a comment