DAX Concept

Creating Dynamic Labels and Tooltips with DAX Measures

Learn to create dynamic labels for card visuals and detailed tooltips for charts using various DAX functions to enhance report interactivity and user experience.

IntermediateVALUESCONCATENATEXSELECTEDVALUERELATEDSUMMARIZE

Concept Breakdown

DAX measures can return text strings that dynamically change based on user selections and visual context within a Power BI report. This allows for personalized labels on card visuals (e.g., showing the name of a selected item) and rich, context-aware tooltips for charts. Key functions include `SELECTEDVALUE` for retrieving a single selected value, `CONCATENATEX` for iterating over a table and concatenating values into a single string (often with formatting and conditional logic), and `RELATED` or `RELATEDTABLE` for accessing data from related tables within the iteration.

What You Will Learn

  1. Understand when to use VALUES, CONCATENATEX, SELECTEDVALUE, RELATED, SUMMARIZE in a Power BI model.

  2. Practice the concept inside a real PBIX report rather than only reading syntax.

  3. Complete a intermediate-level task and verify the result with a hidden answer check.

Practice in Power BI

The starter PBIX link has not been attached yet. The student workflow is ready for the admin to connect the file.

  1. Download and unzip the provided 'Music Tours - Dynamic Labels.pbix' file and open it in Power BI Desktop.

  2. Create a measure named `Selected Artist Name` that returns the name of the currently selected artist.

  3. Create a card visual at the top of both the 'Albums' and 'Tours' pages and assign the `Selected Artist Name` measure to them. Format the cards to align with existing text boxes.

  4. Create a measure named `Album Tooltip Details` that lists album titles along with their year of release, sorted by release date, with each album on a new line (use `UNICHAR(10)`).

  5. Assign the `Album Tooltip Details` measure to the tooltips of the pie chart on the 'Albums' page.

  6. Create a measure named `Track Tooltip Details` that lists track names, sorted by the `Track order` column. Add a gold star emoji (Windows key + '.') next to tracks which reached number 1 in the US Billboard Hot 100 chart.

  7. Assign the `Track Tooltip Details` measure to the tooltips of the column chart on the 'Albums' page.

  8. Create a measure named `Tour Tooltip Details` that lists show dates and venues, sorted by show date and separated by a new line. The `RELATED` function may be useful here.

  9. Assign the `Tour Tooltip Details` measure to the tooltips of the column chart on the 'Tours' page.

  10. Create a measure named `Country Show Counts Tooltip` that lists countries and the count of shows performed in them. Separate each country with a new line, sort them alphabetically, and ensure only countries with actual shows are included. Use the existing `Count Shows` measure if available.

  11. Assign the `Country Show Counts Tooltip` measure to the tooltips of the pie chart on the 'Tours' sheet.

  12. Save and close the report.

Starter DAX

-- To create a new measure, right-click on your table in the Fields pane and select 'New measure'.
-- Replace 'Your Measure Name' with a descriptive name and the 'BLANK()' with your DAX formula.

Your Measure Name = 
    BLANK()

Expected Outcome

A Power BI report where:

  1. Card visuals on 'Albums' and 'Tours' pages dynamically display the name of the artist selected from the 'Menu' page.
  2. The pie chart on the 'Albums' page shows a tooltip with a formatted list of albums and their release years for the selected artist.
  3. The column chart on the 'Albums' page shows a tooltip with a formatted list of tracks, including a gold star emoji next to US #1 hits, for the selected artist.
  4. The column chart on the 'Tours' page shows a tooltip with a formatted list of show dates and venues for the selected artist.
  5. The pie chart on the 'Tours' page shows a tooltip with an alphabetically sorted list of countries and their respective show counts for the selected artist, only including countries with shows.
Checking your sign-in status...