Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am pretty new to power bi.
So I am trying to calculate median and have been getting difference in values when I calculate edian using excel and when I use power bi to do the same.
An example of my table is as follows:
Class | marks | Roll No |
A | 12 | 1 |
A | 45 | 14 |
B | 12 | 13 |
D | 45 | 17 |
C | 24 | 69 |
B | 26 | 40 |
B | 12 | 17 |
C | 15 | 13 |
D | 67 | 66 |
Now I plan at getting median by class. My formula works however there is a difference i result when I compare the same with median from excel.(again i am not talking about the total median but individual medians by class). this diffrence is only when the number of data points(in thiscase count of marks in a class) is odd. Somehow power bi take the average of thee middle and middle +1 value.
Solved! Go to Solution.
Hi @Anonymous ,
I test this in my emviornment, I get result like below
Measure = CALCULATE(MEDIAN('Table'[marks]))
The results are the same, and you could refer to https://www.mathsisfun.com/median.html for logic.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
I have shown DAX in above post , you could refer to it, and below is expression to calculate median in excel
If you have other fields, you also could add it in below expression
CALCULATE(MEDIAN('Table'[marks]), ALLEXCEPT('Table','Table'[Class]))
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
I test this in my emviornment, I get result like below
Measure = CALCULATE(MEDIAN('Table'[marks]))
The results are the same, and you could refer to https://www.mathsisfun.com/median.html for logic.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Could you share the dax used. I do the logic behind getting the medain ut having problems on what result my dax throws me.
Hi @Anonymous ,
I have shown DAX in above post , you could refer to it, and below is expression to calculate median in excel
If you have other fields, you also could add it in below expression
CALCULATE(MEDIAN('Table'[marks]), ALLEXCEPT('Table','Table'[Class]))
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks a lot..Actually i had a flawed logic depening on how my table was build..Your small table kinda helped me understand the same ...Thanks a lot...
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
73 | |
57 | |
36 | |
31 |
User | Count |
---|---|
90 | |
60 | |
60 | |
49 | |
45 |