Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
Dear all,
I'm struggling for finding a way to calculate Median, Q1 and Q2 from a table that is categorized with 'Class':
Class | Value |
A | 20 |
A | 25 |
A | 40 |
A | 13 |
A | 15 |
B | 99 |
B | 101 |
B | 105 |
B | 88 |
B | 91 |
B | 99 |
Q1 and Q3 are quartiles from a dataset, where Q2 = Median.
The output should be, in a new table:
Class | Median | Q1 | Q3 |
A | 20 | 15 | 25 |
B | 99 | 93 | 100.5 |
Could you please demonstrate how to do create a new table?
Best regards,
Cornelis
Solved! Go to Solution.
Hi @CornelisV ,
Please try code as below to create measures.
Median = MEDIAN('Table'[Value])
Q1 = PERCENTILE.INC('Table'[Value],0.25)
Q3 = PERCENTILE.INC('Table'[Value],0.75)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello Rico Zhou,
Thank you for your support, that looks promising.
Could you please expalin me how dit you split into Class A and Class B with the Median, Q1 and Q3 output as listed above?
Best regards,
Cornelis
Hello Rico Zhou,
Thank you for your support, that looks promising.
Could you please expalin me how dit you split into Class A and Class B with the Median, Q1 and Q3 output as listed above?
Best regards,
Cornelis
So, use a Quick calculation, apply like this
Hi @CornelisV
You did not specify the quarter for each row, which makes the calculation logic unclear. Could you please provide the missing details to clarify the logic?
Hi @Ritaf1983
Thank you for your message.
It is not the quartile of each row, but the quartile from a serie.
so serie with class = A have the values in order of the next row:
13 15 20 25 40
The Median = 20, perfect in the middle of a row.
Quartile 1 is 25 % of the row, so Q1 = 15
Quartile 3 is 75 % of the row, so Q3 = 25
Does this make any sense?
Best regards,
Cornelis
Hi @CornelisV ,
Please try code as below to create measures.
Median = MEDIAN('Table'[Value])
Q1 = PERCENTILE.INC('Table'[Value],0.25)
Q3 = PERCENTILE.INC('Table'[Value],0.75)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the May 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
76 | |
72 | |
71 | |
52 | |
48 |
User | Count |
---|---|
45 | |
38 | |
33 | |
31 | |
28 |