Knowledge Base
Zebra BI for Power BI

Dynamic titles in Zebra BI visuals

Applies to:
Zebra BI Tables for Power BI
Zebra BI Charts for Power BI

Since the whole Power BI essence is interactivity it’s safe to say we want to have the complete interactive experience available throughout our reports. The title is a crucial component of any visual presentation because it provides a description or context for the data being presented. Zebra BI Charts and Zebra BI Tables visual support dynamic titles meaning they can reference other fields to bring context into the visual.

How to add contextual fields to the visual

When visual is selected go to the Visualizations pane and scroll down to the last placeholder called Filters.

This placeholder can be populated with measures and dimensional attributes to read the Filters applied to the visual. We can create measures on our own to correspondingly display the desired outcome or insert any field we’d like to return the text in the title when it’s been filtered on the page. The second option will create an implicit measure that works only when a single value is filtered within the slicer or filter. Therefore it’s better to create an explicit measure where everything can be defined correctly.

Let’s examine the result of this configuration. We created a measure called SelectedCountry_ to capture the selected country from the slicer positioned at the top of the page. Below, you’ll find the resulting visualization demonstrating the successful integration of the selected country into the title.

How to create a suitable measure

The best way to get multiple selections displayed is by using a CONCATENATEX function in the measure which will join selections in a string. We also need to make sure that in case no selection was made in a slicer, a measure returns a certain text to avoid displaying all items. Below is a sample measure which can be used in this example.

SelectedCountry_ = 
VAR Country_ =
    CONCATENATEX ( ALLSELECTED ( 'Currency'[Country] ), 'Currency'[Country], ", " )
RETURN
    IF (
        ISFILTERED ( 'Currency'[Country] ),
        Country_,
        "All countries"
    )

Referencing a measure in the title

To establish a dynamic title, follow these steps after creating all necessary measures and adding them to the Filters placeholder:

  • Click on the title to activate the editing functionality.
  • A menu will appear, providing options to Edit the title.
  • Remove the default entry and begin typing the desired references.
  • As you type, suggested references will automatically populate in a dropdown menu.
  • Select the desired measure from the dropdown menu.
  • Confirm the selection by pressing Enter.

Multiple references can be entered in the title.

It’s also possible to consolidate all referenced measures into one by creating a unified measure and inserting only that in the Filters. This comes in handy when the report page is completed and no further changes will be done regarding adding filters/slicers on the page. The measure below was used to create a unified title.

Master title =
[SelectedPeriod_] & " " & [SelectedKPI_] & " " & [SelectedQuarter_] & " " & [SelectedYear_] & " in " & [SelectedCountry_]

Was this article helpful?