1. Lighthouse

Level 5 · A title that follows the slicer

The request

From Jenna Walsh, Marketing Manager

“People screenshot the channel chart into decks, and the title always says 'Sales by category' whatever channel they picked, so nobody can tell later what the picture shows. Can the title say 'Sales for app' when app is picked, and 'Sales for all channels' when nothing or more than one is?”

Your goal

To test it before wiring it into the title, the matrix has orders[channel] on its rows (each row acts like one channel picked in the slicer) and a 2025 year slicer. Create a measure called Chart Title that returns the text "Sales for " followed by the selected channel, or "Sales for all channels" when there isn't exactly one channel in the filter context (the Total row).

  • Fill [Chart Title] on every row of the visualnot done yet
  • The Total row right toonot done yet

Your measure

DAX
Visual
A matrix: rows = orders[channel]; values = [Sales], [Chart Title]
Slicers
'Date'[Year] = 2025
Measures in the report
Sales = CALCULATE(SUM(order_items[line_total]), orders[status] = "completed")
Data pane: tables and columns
  • order_items order_item_id, order_id, product_id, quantity, unit_price, discount_pct, line_total
  • orders order_id, customer_id, order_date, status, channel, shipping_fee, coupon_code
  • products product_id, name, category, subcategory, unit_price, unit_cost, launched_on, is_active
  • customers customer_id, first_name, last_name, email, city, state, signup_date, segment, referral_source
  • returns return_id, order_item_id, returned_on, reason, refund_amount
  • Date Date, Year, Quarter, Month Number, Month, Year Month, Year Quarter, Day, Weekday Number, Weekday

Loading the editor…

    Visual[Chart Title] fills in when you press Check
    The visual before your answer
    channelSalesChart Title
    app995,524.18
    marketplace324,298.57
    web980,346.78
    Total2,300,169.53

    Mote checks your result

    Press Check. Mote fills in your answer and compares it with what the report needs.

    The lesson

    A title that doesn’t change when the reader picks a slicer value is a small lie. The chart now shows app only and the title still says “Sales by category”. The fix is a text measure that reads the selection, used as the title.

    What you are working in

    This is a practice report, not Power BI; Power BI Desktop runs only on Windows. To test the title here, the matrix has a row per channel: each row has exactly the filter a slicer pick of that channel would add, and the Total row has none, like an empty slicer. A DAX engine built for this site evaluates your measure in each cell and compares the text.

    To do it for real in Power BI Desktop: Home → New measure, type the formula, then select the chart and open Format visual → General → Title. Next to the Text box, click the fx button, set Format style to Field value, and choose the measure in What field should we base this on?. The title now follows the slicer.

    SELECTEDVALUE

    SELECTEDVALUE(orders[channel], "all channels")

    It answers one question: has the filter context narrowed this column to exactly one value?

    what the reader did visible channels result
    picked app app “app”
    picked web and app web, app “all channels”
    picked nothing web, app, marketplace “all channels”

    Without the second argument the last two rows return BLANK. It’s shorthand for IF(HASONEVALUE(orders[channel]), VALUES(orders[channel]), "all channels"), which you will still see in older reports.

    Building the text

    & joins text, and numbers are converted on the way:

    Chart Title = "Sales for " & SELECTEDVALUE(orders[channel], "all channels")

    To add a number, format it so it reads well: FORMAT([Sales], "$#,0") turns 995524.18 into $995,524. A subtitle like "2025: " & FORMAT([Sales], "$#,0") works the same way.

    Several selections

    If “web and app” should read as such, list the values instead of falling back:

    Channels = CONCATENATEX(VALUES(orders[channel]), orders[channel], ", ")

    That gives “app, web” for two picks, but all three names when nothing is selected, so most reports combine it with ISFILTERED(orders[channel]) to tell “nothing picked” apart.

    Common mistakes

    • No alternate. The title goes blank or half-written on multi-select.
    • VALUES on its own. "Sales for " & VALUES(orders[channel]) fails as soon as two channels are visible: a table with several rows can’t become one piece of text.
    • Typing the title into the visual. Static text in Title → Text never changes; the measure has to be wired in through fx.

    Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.