Forum Discussion

Snagalapur's avatar
Snagalapur
Icon for Helper IV rankHelper IV
1 year ago

how to add shared column header in matrix

Hi All,

 

Kindly help me create shared column header in matrix. 

 

Ex:

thank you.

3 Replies

  • Hi Snagalapur 

    Assuming you have a table similar in structure to this:


    You could put your period and metric fields on the columns field well and expand down:

    Result would look like this:



    Alternatively, you can create a disconnected table very similar to this:





    And you can create a measure with a switch statement to return the correct value(s):

    MyValue = 
    // retrieve column metric
    VAR _Metric = SELECTEDVALUE(Metric[Metric])
    RETURN
    // return value for specified metric
    CALCULATE(SUM('Table'[Value]), 'Table'[Metric] = _Metric)

     

    • Snagalapur's avatar
      Snagalapur
      Icon for Helper IV rankHelper IV

      thank you so much for details but my data is in same format as mentioned here, not sure how to handle

       

       

      • hnguy71's avatar
        hnguy71
        Icon for Super User rankSuper User

        Hi Snagalapur ,

        You would need to go into PowerQuery do some table transformations to unpivot those columns. You'll likely hearthe phrase: "go long instead of wide" many times throughout your BI journey. 

        So if your table structure is like this:


        You would need to select all the columns that doesn't need pivoting like so:


        Then right-click and of those columns and click "unpivot other columns"


        And your result should look similar to this: