Search code examples
powerbidaxpowerbi-desktopdata-modelingmeasure

Power BI matrix table - Column headers


I have the following matrix table:

Visual Rows:

  • Date -> Month

Visual Columns

  • Empty

Visual Values

  • Value 1 (is a measure)
  • Value 2 (is a measure)
  • Value 3 (is a measure)
  • Value 4 (is a measure)

Currently I get the follwing table:

Month       | Value 1  | Value 2 | Value 3  | Value 4 |
------------------------------------------------------
January     |    47    |    63   |    47    |    63   |
February    |    50    |    42   |    24    |    33   |
March       |    38    |    37   |    75    |    42   |
April       |    12    |    65   |    32    |    39   |
May         |    45    |    30   |    28    |    42   |
June        |    67    |    41   |    36    |    50   |

I would like to add a column so I can devide the values in 2 categories:

  1. Category 1
    • Value 1
    • Value 2
  2. Category 2
    • Value 3
    • Value 4

So I would get a matrix like the following:

            |     Category 1     |      Category 2    |
Month       | Value 1  | Value 2 | Value 3  | Value 4 |
------------------------------------------------------
January     |    47    |    63   |    47    |    63   |
February    |    50    |    42   |    24    |    33   |
March       |    38    |    37   |    75    |    42   |
April       |    12    |    65   |    32    |    39   |
May         |    45    |    30   |    28    |    42   |
June        |    67    |    41   |    36    |    50   |

Is this somehow possible with dax measure?

Thank you for any Help


Solution

  • Create a disconnected table like this named My Table (do not create any relationships to it)

    enter image description here

    Create a measure like this:

    Measure = 
    VAR x= SELECTEDVALUE('My Table'[Measure])
    RETURN
    SWITCH(TRUE(),
        x = "Measure 1", "I'm measure 1",
        x = "Measure 2", "I'm measure 2",
        x = "Measure 3", "I'm measure 3",
        x = "Measure 4", "I'm measure 4",
        BLANK()
    )
    

    Add everything to a matrix and ensure you drill down on columns

    enter image description here