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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Girish_P
Frequent Visitor

Get sum for all rows but Average in grand total in matrix visual

In a matrix visual I want to change the Grand Total field to Grand Average. For example.

 

Screenshot 2020-11-26 123154.jpg

 

2 ACCEPTED SOLUTIONS

Hi @Girish_P ,

 

Modify your measure as below:

avg1z = 
var _sum=SUMX(FILTER(ALL(Sheet1),'Sheet1'[Day]=MAX('Sheet1'[Day])&&'Sheet1'[Row Labels]=MAX('Sheet1'[Row Labels])),'Sheet1'[qnt])
var _distinctcount=CALCULATE(DISTINCTCOUNT(Sheet1[Row Labels]),FILTER(ALL(Sheet1),'Sheet1'[Day]=MAX('Sheet1'[Day])))
Return
IF(ISINSCOPE(Sheet1[Row Labels]),_sum,DIVIDE(SUMX(FILTER(ALL(Sheet1),'Sheet1'[Day]=MAX('Sheet1'[Day])),'Sheet1'[qnt]),_distinctcount))

And you will see:

v-kelly-msft_0-1606787192471.png

For the related .pbix file,pls see attached.

 

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

Hi,

Total = SUM(Sheet1[qnt])
Measure = AVERAGEX(VALUES(Sheet1[Row Labels]),[Total])

Hope this helps.

Untitled.png

Try these measures

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

7 REPLIES 7
Girish_P
Frequent Visitor

@amitchandak @Anonymous 

 

pbix download 

https://1drv.ms/u/s!AuHFzkBFHhqqga9TApvSulUpiJ9hwA?e=HANo68 

 

Thanks for your replies. but the solution is not clear. attaching test pbix for your reference. can you please implement and post it. 

 

Hi  @Girish_P ,

 

Create a measure as below:

avg1 = IF(ISINSCOPE(Sheet1[Row Labels]),MAX('Sheet1'[qnt]),AVERAGEX(FILTER(ALL(Sheet1),'Sheet1'[Day]=MAX('Sheet1'[Day])),'Sheet1'[qnt]))

And you will see:

v-kelly-msft_0-1606718318242.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

@v-kelly-msft  thanks for your reply.

 

but looks like its taking Max at row level instead of sum.

 

pbix link :..

 

https://1drv.ms/u/s!AuHFzkBFHhqqga9YJ1zS6nva_EK7-A?e=kYVcQj

Hi,

Total = SUM(Sheet1[qnt])
Measure = AVERAGEX(VALUES(Sheet1[Row Labels]),[Total])

Hope this helps.

Untitled.png

Try these measures

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Girish_P ,

 

Modify your measure as below:

avg1z = 
var _sum=SUMX(FILTER(ALL(Sheet1),'Sheet1'[Day]=MAX('Sheet1'[Day])&&'Sheet1'[Row Labels]=MAX('Sheet1'[Row Labels])),'Sheet1'[qnt])
var _distinctcount=CALCULATE(DISTINCTCOUNT(Sheet1[Row Labels]),FILTER(ALL(Sheet1),'Sheet1'[Day]=MAX('Sheet1'[Day])))
Return
IF(ISINSCOPE(Sheet1[Row Labels]),_sum,DIVIDE(SUMX(FILTER(ALL(Sheet1),'Sheet1'[Day]=MAX('Sheet1'[Day])),'Sheet1'[qnt]),_distinctcount))

And you will see:

v-kelly-msft_0-1606787192471.png

For the related .pbix file,pls see attached.

 

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@Girish_P ,

Try measure like

avergageX(values(Table[Row Label]),[Day1])

 

avergageX(values(Table[Row Label]),sum(Table[Day1]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Create the measure which  is showing values (10,20,30 ...) with  Average instead of SUM. so it will show 10,20,30 ... remain same since it is lowest level of granularity   and  it will show Average  at grand total .

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors