Expression-based titles in Power BI Desktop
You can create dynamic, customized titles for your Power BI visuals. By creating Data Analysis Expressions (DAX) based on fields, variables, or other programmatic elements, your visuals' titles can automatically adjust as needed. These changes are based on filters, selections, or other user interactions and configurations.
Creating dynamic titles, sometimes called expression-based titles, is straightforward.
Create a field for your title
The first step in creating an expression-based title is to create a field in your model to use for the title.
There are all sorts of creative ways to have your visual title reflect what you want it to say, or what you want to express. Let's take a look at a couple examples.
You can create an expression that changes based on the filter context that the visual receives for the product's brand name. The following image shows the DAX formula for such a field.
Another example is using a dynamic title that changes based on the user's language or culture. You can create language-specific titles in a DAX measure by using the
USERCULTURE() function. This function returns the culture code for the user, based on their operating system or browser settings. You can use the following DAX switch statement to select the correct translated value.
SWITCH ( USERCULTURE(), "de-DE", “Umsatz nach Produkt”, "fr-FR", “Ventes par produit”, “Sales by product” )
Or you can retrieve the string from a lookup table that contains all the translations. You place that table in your model.
These are just a couple of examples you can use to create dynamic, expression-based titles for your visuals in Power BI Desktop. What you can do with your titles are limited only by your imagination, and your model.
Select your field for your title
After you've created the DAX expression for the field you create in your model, you need to apply it to your visual's title.
To select the field and apply it, go to the Visualizations pane. In the Format area, select Title to show the title options for the visual.
When you right-click Title text, a context menu appears that allows you to select fxConditional formatting. When you select that menu item, a Title text dialog box appears.
From that window, you can select the field that you created to use for your title.
Limitations and considerations
There are a few limitations to the current implementation of expression-based titles for visuals:
- Expression-based formatting isn’t currently supported on Python visuals, R visuals, or the Key Influencers visual.
- The field you create for the title must be a string data type. Measures that return numbers or date/time (or any other data type) aren't currently supported.
This article described how to create DAX expressions that turn the titles of your visuals into dynamic fields that can change as users interact with your reports. You might find the following articles useful as well.
Send feedback about: