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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
mlsx4
Memorable Member
Memorable Member

Need to calculate an average

Hello everyone.

 

I have computed a personal rate for a company each day (the number of workers working each day * number of hours per contract) and taking into account if they are on holidays (0) or in a sick leave (0).

 

 

Date rate= 

var num= SUMX(VALUES('Staff'[TRABAJADOR]),CALCULATE(SUMX('Staff','Staff'[% hours worked]),FILTER('Staff','Staff'[Start date]<=MAX('Calendar'[Date]))))

RETURN num* CALCULATE([Sick multiplier],USERELATIONSHIP(Staff[ID worker],'IT/ABS'[employee]))*[day multiplier]

 

 

 If I put it in a column with the name of the worker, it won't add anything to the grand total, therefore I did:

 

 

 

Total rate = 

var summarizedTable = ADDCOLUMNS (
SUMMARIZE ( 'Staff', 'Staff'[Worker],'Staff'[% hours worked]),
"DaysW", CALCULATE ([Date rate]) )

RETURN SUMX(summarizedTable,[Date rate])

 

 

 

And it seems to work nice. Here is an example of the matrix I get (values are Total rate)

 

WorkerDay 1Day 2Day 3Day 4

AAAA

0,50,50,50

BBBB

1,001,001,001,00
CCCC0,750,750,750,75
DDDD0,8750,8751,001,00
EEEEE0,001,000,000,00
Total3,1254,1253,252,75

 

What I need to achieve now, is the average of the total for all days. If I try to do an averagex over total rate, it doesn't work.

Any help would be very appreciated.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You are on the right track, but the AVERAGEX must be done over a SUMMARIZE by Day and sum.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

You are on the right track, but the AVERAGEX must be done over a SUMMARIZE by Day and sum.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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