Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Dynamic Measure Header

Hi PBI Heroes

 

I need some help on a dynamic measure header display based on slicer selections.

Currently, my measure header is as follows by default (without slicer selection):

 

Total Sales 

Total Cost

Total GP

 

But when my slicer of subsidiary is selected (for example ABC or XYZ), i need to measure header to change accordingly to below, depending on single selection. If multiple selections then default header applies.

 

Sales for ABC

Cost for ABC

GP for ABC

 

or 

 

Sales for XYZ

Cost for XYZ

GP for XYZ

 

I have seem a few number of tutorials but mostly are dealing with dynamic column headers and I have no idea how to apply to measures. Bookmarks will not help as well since it might reverse selections of other slicers.

 

Many thanks in advance!

Cheers!

 

Regards

Shao

4 REPLIES 4
danextian
Super User
Super User

Hi @Anonymous ,

 

It seems to me that you have quite a lot of subsidiary and so you want the header to be dynamic and not hardcoded in a formula. You'll need to create every possible combinatin of subsidiary + measures in Power Query and then use DAX to return a value based on slicer selection. If so, please  refer to the attached pbix. Sample result is as shown below:

danextian_0-1697620394023.png

danextian_1-1697620405242.png

danextian_2-1697620463977.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

Hi @danextian 

 

Appreciate the suggestion.

The number of headers should remain as 3 columns (Sales, Cost, GP) with the header name changing according to the selection. In your example, if more than 1 subsidiary is selected, the header name should ideally reflect as the default (i.e Total Sales, Total Cost, Total GP). Same as when no selections are made. 

 

What I need however, is when single selections are made, the header will change and reflect that selection.

Anonymous
Not applicable

Hi @Anonymous ,

Please try to use the SWITCH function with a variable that stores the slicer value. You can then use different cases to return different measure headers based on the slicer value. For example, if you have a slicer called Subsidiary with values ABC and XYZ, you can create a measure header like this:

MeasureHeader =
VAR _Subsidiary =
    SELECTEDVALUE ( Subsidiary[Subsidiary] )
RETURN
    SWITCH (
        _Subsidiary,
        "ABC", "Sales for ABC",
        "XYZ", "Sales for XYZ",
        "Total Sales"
    )

You can then add this measure to your visual header and it will dynamically change based on the slicer selection.

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Anonymous
Not applicable

Hi Rongtie

 

Thanks for the suggestion. However that is not exactly the result I am looking for. I am hoping the measure headers will change dynamically based on my selection but in your proposed solution,  I will be stuck with a static header "MeasureHeader".

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.