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
veronika
New Member

Dynamic percentile ranks across two tables

HI All, 

 

I have a question about calculating percentile rankings.

 

I have two tables, one with products, their categories and various metrics, one of which is Return. Second table is for hierarchy of the categories. 

20-07-2018 16-43-21.png


I need to create a visual with slicers using the category hierarchy values (Group and Sub-group) and a table underneath with the individual products, their return and also percentile ranking or the return based on what is selected in the slicers. That means the percentage ranking would recalculate depending on whether I select only Group or Sub-Group or the end Category. Any thoughts on how to implement that?

Thank you very much, 

Veronika

1 ACCEPTED SOLUTION

Hi Veronika,

 

It's ranks rather than percentile in your scenario. Please try the formula below. Please also refer to PERCENTRANK-Inclusive/td-p/81208.

Measure 2 =
VAR ranks =
    RANKX (
        ALLSELECTED ( Products[Product] ),
        CALCULATE ( SUM ( Products[Return] ) ),
        ,
        ASC
    )
VAR allSelectedAmount =
    CALCULATE ( COUNT ( Products[Product] ), ALLSELECTED ( Products[Product] ) )
RETURN
    ( ranks - 1 )
        / ( allSelectedAmount - 1 )
        * 100

dynamic_percentile

 

Best Regards,

Dale

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

3 REPLIES 3
v-jiascu-msft
Employee
Employee

Hi @veronika,

 

Can you post an expected result? Please try the demo in the attachment. 

Measure =
CALCULATE (
    PERCENTILE.INC ( Products[Return], 0.5 ),
    ALL ( Products[Product] )
)

Best Regards,

Dale

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

Hi Dale,

 

Thanks for the demo, you nearly got what I failed to explain properly. In your result the measure is the same for all products, I assume giving the 50th percentile value. I need the individual percentile ranks for all the products which make it to the table based on the slicers. The values would be from 1-100 (or 0-100) and would differ for all products unless they had the same return. the below is done in excel using "percentrank.inc" function.

23-07-2018 10-47-41.png

Many thanks,

Veronika

Hi Veronika,

 

It's ranks rather than percentile in your scenario. Please try the formula below. Please also refer to PERCENTRANK-Inclusive/td-p/81208.

Measure 2 =
VAR ranks =
    RANKX (
        ALLSELECTED ( Products[Product] ),
        CALCULATE ( SUM ( Products[Return] ) ),
        ,
        ASC
    )
VAR allSelectedAmount =
    CALCULATE ( COUNT ( Products[Product] ), ALLSELECTED ( Products[Product] ) )
RETURN
    ( ranks - 1 )
        / ( allSelectedAmount - 1 )
        * 100

dynamic_percentile

 

Best Regards,

Dale

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

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.