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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.