+44 (0)20 3051 3595 | info@coeo.com | Client portal login

Power BI Tips & Tricks: Creating dynamic titles

Christian Bowman

In this post we will be walking through how to create and use basic dynamic titles that change depending on a slicer's selection.

Here is an example of what we will be building today:

In the example above we have some sales data which has been split into categories that we would like to report on.

Firstly we will need to create a new measure. This can either be in an existing table or a specific Measures table. Right click on the desired table and select “New measure”:

We recommend naming your measures as descriptively as possible. For example, SalesByMonthTitle will be used for our visualization showing the sales made per month of the year. The DAX we will use for this first measure is:

SalesByMonthTitle = IF(SELECTEDVALUE(Category[CategoryDescription]) = BLANK(), "Total", SELECTEDVALUE(Category[CategoryDescription])) & " Sales by Month"

Lets break that down a bit:

We use the IF() statement to say if there isn’t a selected value then return the word Total, else return the selected category description.

We then concatenate the phrase “Sales by Month” onto the end using the “&” symbol. Please note the intentional extra space before the word “Sales”.

Once the measure has been created we then want to set this as our visualization's title.

  1. Select the visualization you want to add the title to
  2. Go to the format painter
  3. Select “Title”
  4. Select the "fx" box under “Title text” highlighted below:

We will then need to select the measure created previously. In this example this is “SalesByMonthTitle”:

We now have a working dynamic title. When no category is selected the report shows “Total Sales by Month”:

And when a category is selected, the report shows “Category C Sales by Month”:

We then created a second measure for sales by customer and here are the finished results:

No category selected:

Category selected:

 

This post is the latest in my series on Power BI Tips & Tricks, you can read my other advice by visiting the topic page on the Coeo blog.

 

Enjoyed this blog? Sign up for monthly updates

Subscribe to Email Updates

Back to top