Forum Discussion

cmckinney's avatar
cmckinney
Icon for Helper IV rankHelper IV
6 years ago
Solved

How do I add average, min and max columns to matrix?

I am trying to add average, min and max column to a matrix. I am a new Power BI user but I am an advanced user in Excel. I was able to accomplish what I need in Excel but I am struggling to firgure i...
  • v-alq-msft's avatar
    6 years ago

    Hi, cmckinney 

     

    There is no direct way to achieve it. As a workaround, you may try the following steps. I created data to reproduce your scenario. The pbix file is attached in the end.

    Table:

     

    You may go to 'Query Editor', make 'Name' column selected, click 'Transform'=>'Unpivot Columns'=>'Unpivot Other Columns', 'Close and Apply'.

     

    Then you need to create measures as below.

    Max = 
    IF(
        NOT(ISINSCOPE('Table'[Date])),
        CALCULATE(
            MAX('Table'[Value]),
            ALLEXCEPT('Table','Table'[Name])
        )
    )
    
    Min = 
    IF(
        NOT(ISINSCOPE('Table'[Date])),
        CALCULATE(
            MIN('Table'[Value]),
            ALLEXCEPT('Table','Table'[Name])
        )
    )
    
    Avg = 
    IF(
        NOT(ISINSCOPE('Table'[Date])),
        CALCULATE(
            AVERAGE('Table'[Value]),
            ALLEXCEPT('Table','Table'[Name])
        )
    )

     

    Result:

     

    Best Regards

    Allan

     

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