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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Prashasti
Frequent Visitor

Median of a column in Table Visualization

Hello,

I have table which has iteration and points covered in each iteration as shown below. I need to group the table as shown in figure 2. The second table contains distinct iterations and total points covered in that iteration. Is there a way to calculate the median of these total points covered in Power BI? I need to use the median for further calculation.

 

Thanks,

Prashasti

Capture.PNG

2 ACCEPTED SOLUTIONS
LivioLanzo
Solution Sage
Solution Sage

Hi @Prashasti

 

you van calculate the median like this:

 

=
MEDIANX (
    ADDCOLUMNS (
        SUMMARIZE ( Data, Data[Iteration] ),
        "Total Points", 1.0 * CALCULATE ( SUM ( Data[Points] ) )
    ),
    [Total Points]
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

Hi @Prashasti

 

You may try with below measure.

Media =
MEDIANX (
    SUMMARIZE ( Data, Data[Iteration] ),
    CALCULATE ( SUM ( Data[Points] ) )
)
Percent =
DIVIDE ( SUM ( Data[Points] ), CALCULATE ( [Media], ALL ( Data ) ) )

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
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

5 REPLIES 5
LivioLanzo
Solution Sage
Solution Sage

Hi @Prashasti

 

you van calculate the median like this:

 

=
MEDIANX (
    ADDCOLUMNS (
        SUMMARIZE ( Data, Data[Iteration] ),
        "Total Points", 1.0 * CALCULATE ( SUM ( Data[Points] ) )
    ),
    [Total Points]
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Thanks @LivioLanzo, It worked.. I had another doubt. Is it possible to divide the total points of each iteration by the median calculated in this measure? ( In this case 32/38) I need this to calculate the percentage for iteration.

TIA.

Hi @Prashasti

 

You may try with below measure.

Media =
MEDIANX (
    SUMMARIZE ( Data, Data[Iteration] ),
    CALCULATE ( SUM ( Data[Points] ) )
)
Percent =
DIVIDE ( SUM ( Data[Points] ), CALCULATE ( [Media], ALL ( Data ) ) )

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey @v-cherch-msft,

 

In my actual table there are many iterations and I need to display the top 6 iterations and get the score for them. I modified your percent solution to use AllSelected() instead of All() as suggested by you. However, in my graph visualization(Custom Column Chart), upon selecting a particular iteration,the value of percent changes to 1 for all iterations. 

Hoping you could help out here.

 

Thanks,

Prashasti

 

Capture2.PNGCapture1.PNG

Thank you @v-cherch-msft , the measure worked perfectly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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