top of page

Display units to none for all visuals with a custom report theme

Updated: 7 hours ago

Dynamic format strings for measures and dynamic format strings on calculation groups only really has one natural enemy in the report. Public enemy number 1 for dynamic format strings is display units setting on visuals!


Lately I've been exporting themes for reports, and I realized I could have solved my own problems with a few lines of json. Here is the custom theme, which can be used on its own or incorporated into your own custom theme, to turn all visuals display units to none.


{
  "$schema": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/Report%20Theme%20JSON%20Schema/reportThemeSchema-2.149.json",
  "name": "DisplayUnitsNone",
  "visualStyles": {
    "*": {
      "*": {
        "*": [
          {
            "displayUnits": 1,
            "labelDisplayUnits": 1,
            "titleDisplayUnits": 1,
            "detailDisplayUnits": 1,
            "valueDisplayUnits": 1,
            "secLabelDisplayUnits": 1,
            "titleLabelDisplayUnits": 1
          }
        ]
      }
    },
    "cardVisual": {
      "*": {
        "*": [{
            "$id": "default",
            "displayUnits": 1,
            "labelDisplayUnits": 1,
            "titleDisplayUnits": 1,
            "detailDisplayUnits": 1,
            "valueDisplayUnits": 1,
            "secLabelDisplayUnits": 1,
            "titleLabelDisplayUnits": 1
          }
        ]
      }
    }
  }
}
 

The * are wildcards that mean all visuals. Card visual needs the default preset to be specifically called out, so that's why it had to have its own section.


Power BI supports these display unit values:

Value

Display Mode

Example Output

Description

0

Auto

Varies

Power BI automatically chooses the best unit

1

None

1,234,567

Shows raw numbers without abbreviation

1000

Thousands

1.2K

Shows numbers in thousands with "K" suffix

1000000

Millions

1.2M

Shows numbers in millions with "M" suffix

1000000000

Billions

1.2B

Shows numbers in billions with "B" suffix

1000000000000

Trillions

1.2T

Shows numbers in trillions with "T" suffix

-1

Custom

Varies

Uses custom format string (some visuals only)

Different display unit properties work in different contexts:

Property Name

Context

Custom Option (-1)

Used In

labelDisplayUnits

Standard axis and data labels

❌ No

Axis labels, data labels, general formatting

detailLabelDisplayUnits

Detail labels in callouts/tooltips

✅ Yes

Callout value formatting, detail displays

titleLabelDisplayUnits

Title labels

✅ Yes

Callout title formatting, heading displays

dataLabelDisplayUnits

Reference line data labels

❌ No

Reference line label formatting


Each of the display units' settings also have a precision setting if you wanted to set that too.


            "precision": 2,
            "labelPrecision": 2,
            "titlePrecision": 2,
            "detailPrecision": 2,
            "valuePrecision": 2,
            "secLabelPrecision": 2,
            "titleLabelPrecision": 2

You may be wondering, what is the display units setting? Well, it's a setting in the formatting of each visual to show a number in a shorter way on axis and labels.


In simple cases it's fine, and helpful. Simple as in it doesn't have a dynamic format string and the numbers are closer in range. Here it's picked millions with M:


ree

If I select something with a smaller range the visual does update. Now showing thousands in K.


ree

In both of these scenarios, the visual has to pick one style and go with it.


This means the first drawback in a simple scenario is if there is a large gap between the numbers it can only pick 1000s (1K), 1000000s (1M), or 1000000000s (1B) and it has to then pick something not helpful for all values. Here I have no idea what those small numbers are at the beginning of the line are without checking the tooltip.


ree

So here we can use a dynamic format string to make this a better experience. I create a new measure for Sales amount sum and change the format to dynamic.


ree

So far, so good. Note this example is close to the display unit's functionality but you can do whatever you want in a dynamic format string expression!


Except having the dynamic format string measure in the visual with display units set to auto causes this experience! Now all numbers are awful! 😔

ree

This fix here is to turn display units to none on the visual.


ree

Now we see the data labels showing different formats based on individual data points range, which is what we wanted!


But now I have a new problem. Every visual I add will have to have display units set to none, and they are auto by default! This is where the theme at the beginning of this post comes into play. Now I can ensure all visuals start with display units set to none. I can still opt into other display unit settings for a specific visual too, if I needed to.



And more info on the custom theme json file and how to add it to your report is available here: Use report themes in Power BI Desktop - Power BI | Microsoft Learn


Themes are really powerful, giving you control over every formatting setting and now even includes multiple presets too.







 
 
 

© 2021-2025 by Zoe Douglas (DataZoe). Proudly created with Wix.com.

  • GitHub
  • LinkedIn
bottom of page