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! Learn more

Reply
KiPa
Frequent Visitor

Calculate Median for different weeks in one column

Hi All

I tried to search but as I am newbie here it is still difcicult to understand complex topics, so I would like to share the full scenario to get it right.

I need to calculate performance of each employee and compare it to the team median weekly.

In Excel I have easy one, but power BI keeps throwing me errors, could you please check and advise?

Thank you so much

KiPa 

 

Column A is Employee ID
Coulmn B is week name
Column C is calculation - SUM of defined KPIs

Column D is team median for each week

Column E is the final result - comparison of individual result to team median result for each of the weeks

 

KiPa_0-1731266849662.png

 

Employee IDWeek nameIndex = calculated column for each employeeWeekly median indexFinal employee's index in the week
AW0112.7515.1983.92
BW0114.4515.1995.14
CW0112.7115.1983.69
DW0118.6615.19122.83
EW0127.2015.19179.09
FW0115.9215.19104.86
AW0218.8319.7095.60
BW020.0019.700.00
CW0220.5619.70104.40
DW0220.7019.70105.10
EW022.4019.7012.18
FW0229.3619.70149.05
AW0330.0527.03111.17
BW0325.9627.0396.03
CW030.0027.030.00
DW0323.9827.0388.71
EW0331.1127.03115.09
FW0328.1027.03103.97
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

7 REPLIES 7
lbendlin
Super User
Super User

lbendlin_0-1731275783189.png

see attached

KiPa
Frequent Visitor

Hello @lbendlin 

thanks for the formula, it really works well - untill I use the slicer.

Meaning if I filter by employee ID it will recalculate the team weekly median.

An then the ratio which is the result will change too.

Is there any other way please?

Thank you

ki

 

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

KiPa
Frequent Visitor

Thank you,

the original data:

Employee IDWeek nameIndex = calculated column for each employeeWeekly median indexFinal employee's index in the week
AW0112.7515.1983.92
BW0114.4515.1995.14
CW0112.7115.1983.69
DW0118.6615.19122.83
EW0127.2015.19179.09
FW0115.9215.19104.86
AW0218.8319.7095.60
BW020.0019.700.00
CW0220.5619.70104.40
DW0220.7019.70105.10
EW022.4019.7012.18
FW0229.3619.70149.05
AW0330.0527.03111.17
BW0325.9627.0396.03
CW030.0027.030.00
DW0323.9827.0388.71
EW0331.1127.03115.09
FW0328.1027.03103.97

 

The formula you advised indeed calculates the weekly median for the whole team. However if I want to filter out some team members or if I want to focus on one individual, the team median gets recalculated for each scenario. Using slicer.

Similar like this - removing emplyee A and C will bring new medians, which is not what I need, the expectations should be the same for everyone.

 

Employee IDWeek nameIndex = calculated column for each employeeWeekly median indexFinal employee's index in the week
BW0114.4517.2983.57
DW0118.6617.29107.89
EW0127.2017.29157.32
FW0115.9217.2992.11
BW020.0011.550.00
DW0220.7011.55179.26
EW022.4011.5520.78
FW0229.3611.55254.20
BW0325.9627.0396.03
DW0323.9827.0388.71
EW0331.1127.03115.09
FW0328.1027.03103.97

 

thank you, ki

Make it a calculated column if you don't want it to be impacted by filters.

KiPa
Frequent Visitor

I am Sorry I think I wasnt clear

I need to have weekly median that remains the same also after filtering the empoyee id - so I can review the data for individual, or half of the team.

The formula provided works well while counting for the whole team and particular week, but any filtering changes the weekly median.

 

Altogeter: 

Correct without any filtes, using the "med = CALCULATE(MEDIANX('Table',[Index]),REMOVEFILTERS('Table'[Employee ID]))" 
Employee IDWeek nameIndex = calculated column for each employeeWeekly median indexFinal employee's index in the week
AW0112.7515.1983.92
BW0114.4515.1995.14
CW0112.7115.1983.69
DW0118.6615.19122.83
EW0127.2015.19179.09
FW0115.9215.19104.86
AW0218.8319.7095.60
BW020.0019.700.00
CW0220.5619.70104.40
DW0220.7019.70105.10
EW022.4019.7012.18
FW0229.3619.70149.05
AW0330.0527.03111.17
BW0325.9627.0396.03
CW030.0027.030.00
DW0323.9827.0388.71
EW0331.1127.03115.09
FW0328.1027.03103.97

 

 

Using filters - wrong wekly median  
Employee IDWeek nameIndex = calculated column for each employeeWeekly median indexFinal employee's index in the week
BW0114.4517.2983.57
DW0118.6617.29107.89
EW0127.2017.29157.32
FW0115.9217.2992.11
BW020.0011.550.00
DW0220.7011.55179.26
EW022.4011.5520.78
FW0229.3611.55254.20
BW0325.9627.0396.03
DW0323.9827.0388.71
EW0331.1127.03115.09
FW0328.1027.03103.97

 

Using filters - correct weekly median - same as in unfiltered box 
Employee IDWeek nameIndex = calculated column for each employeeWeekly median indexFinal employee's index in the week
BW0114.4515.1995.14
DW0118.6615.19122.83
EW0127.2015.19179.09
FW0115.9215.19104.86
BW020.0019.700.00
DW0220.7019.70105.10
EW022.4019.7012.18
FW0229.3619.70149.05
BW0325.9627.0396.03
DW0323.9827.0388.71
EW0331.1127.03115.09
FW0328.1027.03103.97

 

I need to get to this 3rd option

Thank you

KiPa
Frequent Visitor

@lbendlin - Thanks a lot for your help, this really works well and I learnt new function. You safed me 🙂

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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