Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Matrix

Hello, I got this Matrix with this information:

 

And i would like to have the information on the row. For exemple this:

 

But I don't know what to put in my rows to have this because I dont have a column with those 3 names in my power bi.

Do you know how to do it?

Thanks

 

  • Anonymous,

     

    1. Create a Table with the Enter Data Option with a column (MeasureName) that will have three rows(based on the example) - Production, Sant Effet, and Production nette
    2. Create a measure: 
    Value =
    VAR SelValue =
        SELECTEDVALUE ( Table[MeasureName] )
    RETURN
        SWITCH (
            TRUE (),
            SelValue = "Production", SUM ( MainTable[Production] ),
            SelValue = "Sant Effet", SUM ( MainTable[Sant Effet] ),
            SelValue = "Production nette", SUM ( MainTable[Production nette] )
        )

     3. Add MeasureName to Rows and Value Measure to Column

     

    It will work.

10 Replies

  • HI Anonymous ,

     

    Under ROWS section you can move only a column.

    Do you have something in your data like a categorical column with 3 values as categories that you have moved the measures for?

    I am assuming that under VALUES section you moved 3 measures.

     

    Thanks,

    Pragati

    • Anonymous's avatar
      Anonymous
      Not applicable

      Pragati11 Hello, no as my 3 values are measure I don't have a categorical column with my values name.

      • Pragati11's avatar
        Pragati11
        Super User

        HI Anonymous ,

         

        In that case follow the solution mentioned by SivaMani using the approach of a disconnected table.

         

        Thanks,

        Pragati

  • SivaMani's avatar
    SivaMani
    Resident Rockstar

    Anonymous,

     

    1. Create a Table with the Enter Data Option with a column (MeasureName) that will have three rows(based on the example) - Production, Sant Effet, and Production nette
    2. Create a measure: 
    Value =
    VAR SelValue =
        SELECTEDVALUE ( Table[MeasureName] )
    RETURN
        SWITCH (
            TRUE (),
            SelValue = "Production", SUM ( MainTable[Production] ),
            SelValue = "Sant Effet", SUM ( MainTable[Sant Effet] ),
            SelValue = "Production nette", SUM ( MainTable[Production nette] )
        )

     3. Add MeasureName to Rows and Value Measure to Column

     

    It will work.

    • Anonymous's avatar
      Anonymous
      Not applicable

      SivaMani Thank you but if I do it, the matrix will not be changing with a filter in my report right?. For exemple if I change a filter in my report it would not calculate again my measure Production, Sans Effet and Production nette and display the correct values. It will display the old values. To information, my 3 measures can be filter thanks to 2 columns, columns "X" and "Y". Can we had a line of code in your code to allowed the matrix to recalculate the values whena filter changed?

      Thanks