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

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.

Reply
CornelisV
Helper III
Helper III

Calculation median, Q1 and Q2 from grouped data in a new table (descriptive statistics)

Dear all,

 

I'm struggling for finding a way to calculate Median, Q1 and Q2 from a table that is categorized with 'Class':

ClassValue
A20
A25
A40
A13
A15
B99
B101
B105
B88
B91
B99

 Q1 and Q3 are quartiles from a dataset, where Q2 = Median.

The output should be, in a new table:

ClassMedian Q1Q3
A201525
B9993100.5

 

Could you please demonstrate how to do create a new table?

 

Best regards,

 

Cornelis

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

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.

vrzhoumsft_0-1728028844351.png

 

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.

 

 

View solution in original post

CornelisV
Helper III
Helper III

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

View solution in original post

5 REPLIES 5
CornelisV
Helper III
Helper III

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

CornelisV_0-1728394284187.png

So, use a Quick calculation, apply like this 

Q1 = PERCENTILE.INC('Source'[Value],0.25)
and the calculation will be automatically done by group.
Ritaf1983
Super User
Super User

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?

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

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

 

Anonymous
Not applicable

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.

vrzhoumsft_0-1728028844351.png

 

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.

 

 

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.