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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
cmckinney
Helper IV
Helper IV

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 it out in Power BI

 

Here is what it looks like in Excel:

 

Excel.png

 

The data also needs to auto update as per what is displayed in the matrix. What I mean by this is that if you only select two days worth of tests it should show the average for just those two days. If you show all of the days for the tests it needs to show the average for all days. 

 

Here is what I have so far in Power BI:

 

Power BI.png

 

Thank you in advance for your help.

2 ACCEPTED SOLUTIONS
v-alq-msft
Community Support
Community Support

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:

f1.PNG

 

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

f2.PNG

f3.PNG

 

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:

f4.PNG

 

Best Regards

Allan

 

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

View solution in original post

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @cmckinney 

 

Here's a little tweak.

 

2020-06-27 22_37_23-How do I add average, min and max columns to matrix._v2pbix - Power BI Desktop.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

8 REPLIES 8
v-alq-msft
Community Support
Community Support

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:

f1.PNG

 

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

f2.PNG

f3.PNG

 

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:

f4.PNG

 

Best Regards

Allan

 

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

Awesome! Thank you so much, this is a great solution. Is there anyway to remove the min, max, and average columns under each date and just have them as a total column at the end?

 

Hi, @cmckinney 

 

Unfortunately, it is unavailable to remove  the min, max, and average columns under each date. The workaround is an alternative to achieve your requirement.

 

Best Regards

Allan

 

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

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @cmckinney 

 

Here's a little tweak.

 

2020-06-27 22_37_23-How do I add average, min and max columns to matrix._v2pbix - Power BI Desktop.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


@mwegener 

 

Thank you for the feedback. That should work. 

 

I am working on implimenting that right now but I am running into some issues. Do you know what I might be doing wrong?

 

Problem 1.pngProblem 2.png

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @cmckinney ,

expand the hierarchy.

Expand Hierarchy_2.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


mwegener
Most Valuable Professional
Most Valuable Professional

Hi @cmckinney ,

 

this cannot currently be shown in a matrix.

Another column area would be required.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Thank you for your prompt reply. 

 

I have also figure out how to pivot the table in the Power Query Editor view. Is there any way to add the min, max and average rows in this way?

 

Query.png

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.