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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
spuri_78
Regular Visitor

Median and Distinct

Hi all,

 

I'm having difficultiues calculating median of employee sick hours. The measure I have in place is 

Sick Hours Median = MEDIAN('T Sick'[SumOfSick Hours]).
 
The table has Emp Id, Surname, First Name, Org Unit, Division, Branch, Report Group, Unit and Sum of Sick Hrs.
 
However, it's not giving me the correct value. The table has multiple Emp Ids and it is adding up the hours. In excel, when I pivot on emp id and sick hours and then do the median, it gives me the correct value.
 
Any help with this would be greatly appreciated!
1 ACCEPTED SOLUTION
Shravan133
Super User
Super User

Try this:

 

Sick Hours Median =
MEDIANX(
VALUES('T Sick'[Emp Id]),
CALCULATE(SUM('T Sick'[SumOfSick Hours]))
)

View solution in original post

3 REPLIES 3
Shravan133
Super User
Super User

Try this:

 

Sick Hours Median =
MEDIANX(
VALUES('T Sick'[Emp Id]),
CALCULATE(SUM('T Sick'[SumOfSick Hours]))
)

Absolute legend, my friend - mind explaining the formula a bit?

 

  • VALUES('T Sick'[Emp Id]) ensures that we are calculating the median across distinct employees.
  • CALCULATE(SUM('T Sick'[SumOfSick Hours])) calculates the sum of sick hours for each employee.
  • MEDIANX then calculates the median across those individual sums for each employee.

 

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.

Top Solution Authors