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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
ERing
Post Patron
Post Patron

How to create Matrix Headers?

I'm stuck and still looking for help on how to create Matrix Headers like in the visual below. I've been suggested using parameters, calculation groups, and a disconnected table with switch measure, but I haven't been able to make any of those suggestions work with my data.

Would be extremely appreciative if anyone is willing to use the sample file to provide a solution.

Matrix Headers Example 

Matrix Headers Example.png


2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @ERing 


Aside from what @ERing  mentioned, you can create a headers table using DAX or M (via the enter data option). The key point is that a physical column is required to assign the output of a measure. Field parameters are suitable if your goal is to choose which columns to display, but they are not compatible with hierarchical structures. Please see the attached pbix.

 

danextian_0-1743843126450.png

danextian_1-1743843147519.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.

View solution in original post

Hi again @ERing ,

Good point! Columns with all blanks are hidden by default.

 

I would recommend selecting "Show items with no data" on the Column fields only (assuming that is where the measures are placed).

 

This will ensure that all measure columns are always displayed regardless, without introducing unwanted nonblank measure values.

 

OwenAuger_0-1743934975166.png

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

6 REPLIES 6
ERing
Post Patron
Post Patron

@danextian @OwenAuger 

I've run into an unexpected issue after implementing the solution.

 

Measures that result in "0" are not being popluated in my matrix. This occurs when the Matrix is filtered to only show limited CHANNEL_NAME where there may not be values for each column (Actual, PY, Budget, % vs PY, % vs Budget)

Each category (Spend, Revenue, Calls, Conversions) should have a column for Actual, PY, Budget, % vs PY,  % vs Budget). 

You can see in the screen capture that the "Spend" category is missing Actual.
The "Revenue" category is missing Actual, PY, % vs PY.
The "Calls" category is missing Actual, PY, % vs PY.

The "Budget" and "% vs Budget" are showing becuase I've set those measures = " ".

Is there anything I can do to correct this to show each column shows even if there is no value?


Category.png

 

Category Two.png

Measure.png

Hi again @ERing ,

Good point! Columns with all blanks are hidden by default.

 

I would recommend selecting "Show items with no data" on the Column fields only (assuming that is where the measures are placed).

 

This will ensure that all measure columns are always displayed regardless, without introducing unwanted nonblank measure values.

 

OwenAuger_0-1743934975166.png

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Wonderful! I'm glad it was an easy fix.

ERing
Post Patron
Post Patron

@danextian @OwenAuger 

Thank you both very much for your help! I was finally able to get the solution applied to my real data.

danextian
Super User
Super User

Hi @ERing 


Aside from what @ERing  mentioned, you can create a headers table using DAX or M (via the enter data option). The key point is that a physical column is required to assign the output of a measure. Field parameters are suitable if your goal is to choose which columns to display, but they are not compatible with hierarchical structures. Please see the attached pbix.

 

danextian_0-1743843126450.png

danextian_1-1743843147519.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.
OwenAuger
Super User
Super User

Hi @ERing 

Two main options I would consider (updated PBIX attached):

1. Calculation group

  • Create one calculation item per measure, with name matching the measure and the expression simply referencing the measure.
  • Set the format string expression the same as the measure (enclosed in double quotes).
  • Add a "Measure Group" calculated column to the calculation group.
  • Add a "Measure Group Ordinal" column to specify the sort order of Measure Group (note that its expression cannot reference the "Measure Group" column, but can reference the "Measure" calculation item column.
  • Set "Measure Group" to sort by "Measure Group Ordinal".
  • Place "Measure Group" and "Measure" on Columns of the matrix, and an arbitrary measure on Values (as it will be replaced by each calculation item expression).
  • Fully expand matrix Columns.
  • Format matrix and rename fields as required. I replaced "Measure Group" with a space character.

OwenAuger_0-1743838203844.png

 

2. SWITCH measure

  • Create a regular table in the same structure as the above calcuation group.
  • Create a measure as follows:
Selected Measure = 
SWITCH (
    SELECTEDVALUE ( 'Measure Table'[Measure] ),
    "Leads_Budget", [Leads_Budget],
    "Leads_Actual", [Leads_Actual],
    "Conversions_Budget", [Conversions_Budget],
    "Conversions_Actual", [Conversions_Actual],
    "Marketing_Budget", [Marketing_Budget],
    "Marketing_Spend_Actual", [Marketing_Spend_Actual],
    "Revenue_Budget", [Revenue_Budget],
    "Revenue_Actual", [Revenue_Actual]
)
  • Specify a dynamic format string for this measure:
VAR NumberFormat = "#,0"
VAR CurrencyFormat = "\$#,0;(\$#,0);\$#,0"
RETURN
    SWITCH (
        SELECTEDVALUE ( 'Measure Table'[Measure] ),
        "Leads_Budget", NumberFormat,
        "Leads_Actual", NumberFormat,
        "Conversions_Buget", NumberFormat,
        "Conversions_Actual", NumberFormat,
        "Marketing_Budget", CurrencyFormat,
        "Marketing_Spend_Actual", CurrencyFormat,
        "Revenue_Budget", CurrencyFormat,
        "Revenue_Actual", CurrencyFormat
    )
  • Set "Measure" to sort by "Ordinal" and "Measure Group" to sort by "Measure Group Ordinal".
  • Place "Measure Group" and "Measure" on Columns of the matrix, and "Selected Measure" on Values.
  • Fully expand matrix Columns.
  • Disable Column subtotals.
  • Format matrix and rename fields as required. I replaced "Measure Group" with a space character.

OwenAuger_2-1743838594024.png

 

Field parameters aren't a good option for this kind of layout because the set of measures from the field parameter that are displayed in the visual is determined once at the visual-level, so different sets of measures cannot be displayed within different groups.

 

Hopefully that helps!

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

"); $(".slidesjs-pagination" ).prependTo(".pagination_sec"); $(".slidesjs-pagination" ).append("
"); $(".slidesjs-play.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-stop.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-pagination" ).append(""); $(".slidesjs-pagination" ).append(""); } catch(e){ } /* End: This code is added by iTalent as part of iTrack COMPL-455 */ $(".slidesjs-previous.slidesjs-navigation").attr('tabindex', '0'); $(".slidesjs-next.slidesjs-navigation").attr('tabindex', '0'); /* start: This code is added by iTalent as part of iTrack 1859082 */ $('.slidesjs-play.slidesjs-navigation').attr('id','playtitle'); $('.slidesjs-stop.slidesjs-navigation').attr('id','stoptitle'); $('.slidesjs-play.slidesjs-navigation').attr('role','tab'); $('.slidesjs-stop.slidesjs-navigation').attr('role','tab'); $('.slidesjs-play.slidesjs-navigation').attr('aria-describedby','tip1'); $('.slidesjs-stop.slidesjs-navigation').attr('aria-describedby','tip2'); /* End: This code is added by iTalent as part of iTrack 1859082 */ }); $(document).ready(function() { if($("#slides .item").length < 2 ) { /* Fixing Single Slide click issue (commented following code)*/ // $(".item").css("left","0px"); $(".item.slidesjs-slide").attr('style', 'left:0px !important'); $(".slidesjs-stop.slidesjs-navigation").trigger('click'); $(".slidesjs-previous").css("display", "none"); $(".slidesjs-next").css("display", "none"); } var items_length = $(".item.slidesjs-slide").length; $(".slidesjs-pagination-item > button").attr("aria-setsize",items_length); $(".slidesjs-next, .slidesjs-pagination-item button").attr("tabindex","-1"); $(".slidesjs-pagination-item button").attr("role", "tab"); $(".slidesjs-previous").attr("tabindex","-1"); $(".slidesjs-next").attr("aria-hidden","true"); $(".slidesjs-previous").attr("aria-hidden","true"); $(".slidesjs-next").attr("aria-label","Next"); $(".slidesjs-previous").attr("aria-label","Previous"); //$(".slidesjs-stop.slidesjs-navigation").attr("role","button"); //$(".slidesjs-play.slidesjs-navigation").attr("role","button"); $(".slidesjs-pagination").attr("role","tablist").attr("aria-busy","true"); $("li.slidesjs-pagination-item").attr("role","list"); $(".item.slidesjs-slide").attr("tabindex","-1"); $(".item.slidesjs-slide").attr("aria-label","item"); /*$(".slidesjs-stop.slidesjs-navigation").on('click', function() { var itemNumber = parseInt($('.slidesjs-pagination-item > a.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); });*/ $(".slidesjs-stop.slidesjs-navigation, .slidesjs-pagination-item > button").on('click keydown', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); var itemNumber = parseInt($('.slidesjs-pagination-item > button.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); }); $(".slidesjs-play.slidesjs-navigation").on('click', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); }); $(".slidesjs-pagination-item button").keyup(function(e){ var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); $(".slidesjs-stop.slidesjs-navigation").trigger('click').blur(); $("button.active").focus(); } }); $(".slidesjs-play").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-stop").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-play")) { $(".slidesjs-stop").focus(); } } }); $(".slidesjs-stop").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-play").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-stop")) { $(".slidesjs-play").focus(); } } }); $(".slidesjs-pagination-item").keydown(function(e){ switch (e.which){ case 37: //left arrow key $(".slidesjs-previous.slidesjs-navigation").trigger('click'); e.preventDefault(); break; case 39: //right arrow key $(".slidesjs-next.slidesjs-navigation").trigger('click'); e.preventDefault(); break; default: return; } $(".slidesjs-pagination-item button.active").focus(); }); }); // Start This code is added by iTalent as part of iTrack 1859082 $(document).ready(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); $("#tip2").attr("aria-hidden","true").addClass("hidden"); $(".slidesjs-stop.slidesjs-navigation, .slidesjs-play.slidesjs-navigation").attr('title', ''); $("a#playtitle").focus(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").mouseover(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").blur(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#playtitle").mouseleave(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#play").keydown(function(ev){ if (ev.which ==27) { $("#tip1").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); $("a#stoptitle").focus(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").mouseover(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").blur(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").mouseleave(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").keydown(function(ev){ if (ev.which ==27) { $("#tip2").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); }); // End This code is added by iTalent as part of iTrack 1859082
Top Solution Authors