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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate average instead Total in Matrix subtotals

Hello,

The matrix in the screenshot below compares two dates based on the date selection from the left filters.

I want to re-create the measure “Labour_Hour_Compare” to calculate the average instead total for the subtotals at the bottom of the Matrix but can’t figure out a way and need some help.

I have created a separate table to opull the dates to use  in the Labour_Hour_Compare” measure

Dates = VALUES('Sample Data'[Date])

I have included a sample from the dataset too.

image.pngimage.png

Data Set :

Date                                        DayName     HourDesc    Location      Area          Labour_Hours

19/02/2021Fri0-1AR0
19/02/2021Fri0-1BR0
19/02/2021Fri0-1CR1
21/02/2021Sun0-1AR0
21/02/2021Sun0-1BR0
19/02/2021Fri1-2CR0
20/02/2021Sat0-1BR0
20/02/2021Sat0-1AR0
19/02/2021Fri2-3CR0
19/02/2021Fri3-4CR0
19/02/2021Fri10-11AR0
19/02/2021Fri10-11BR1
21/02/2021Sun10-11BR0
20/02/2021Sat10-11BR1
19/02/2021Fri4-5CR0
20/02/2021Sat10-11AR1
19/02/2021Fri5-6CR0
21/02/2021Sun10-11AR1
19/02/2021Fri6-7CR0
19/02/2021Fri11-12AR0
19/02/2021Fri11-12BR0
21/02/2021Sun11-12BR1
20/02/2021Sat11-12AR1
19/02/2021Fri7-8CR0
20/02/2021Sat11-12BR0
19/02/2021Fri8-9CR0
21/02/2021Sun11-12AR1
19/02/2021Fri1-2AR0
19/02/2021Fri10-11CR0
19/02/2021Fri1-2BR0
20/02/2021Sat1-2AR0
19/02/2021Fri11-12CR1
20/02/2021Sat1-2BR0
21/02/2021Sun1-2BR0
19/02/2021Fri12-13CR0
21/02/2021Sun1-2AR0
19/02/2021Fri12-13AR0
19/02/2021Fri12-13BR0
19/02/2021Fri13-14CR1
21/02/2021Sun12-13AR0
19/02/2021Fri14-15CR1
20/02/2021Sat12-13BR0
20/02/2021Sat12-13AR1
21/02/2021Sun12-13BR0
19/02/2021Fri15-16CR0
19/02/2021Fri13-14BR0
19/02/2021Fri13-14AR1
19/02/2021Fri16-17CR1
20/02/2021Sat13-14BR0
20/02/2021Sat13-14AR0
19/02/2021Fri17-18CR1
21/02/2021Sun13-14BR0
21/02/2021Sun13-14AR1
19/02/2021Fri18-19CR1
19/02/2021Fri14-15BR1
19/02/2021Fri14-15AR1
19/02/2021Fri19-20CR0
20/02/2021Sat14-15BR0
19/02/2021Fri20-21CR1
21/02/2021Sun14-15BR0
20/02/2021Sat14-15AR0
21/02/2021Sun14-15AR0
1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this measure

Labour_Hour_Compare = 
VAR selected_Date =
    SELECTEDVALUE ( 'Dates'[Date], MAX ( 'Dates'[Date] ) )
return AVERAGEX(KEEPFILTERS(VALUES('Sample Date'[HourDesc])),CALCULATE ( SUM ( 'Sample Date'[Labour_Hours] ), 'Sample Date'[Date] = selected_Date )
)

31.png

 

Reference: https://community.powerbi.com/t5/Desktop/Avg-Subtotal/td-p/636622

 

 

 

Best Regards,

Stephen Tao

 

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

1 REPLY 1
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this measure

Labour_Hour_Compare = 
VAR selected_Date =
    SELECTEDVALUE ( 'Dates'[Date], MAX ( 'Dates'[Date] ) )
return AVERAGEX(KEEPFILTERS(VALUES('Sample Date'[HourDesc])),CALCULATE ( SUM ( 'Sample Date'[Labour_Hours] ), 'Sample Date'[Date] = selected_Date )
)

31.png

 

Reference: https://community.powerbi.com/t5/Desktop/Avg-Subtotal/td-p/636622

 

 

 

Best Regards,

Stephen Tao

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.