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
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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors