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
Anonymous
Not applicable

Using column from another table for percentile calculation

Hi, I am trying to calculate percentiles for my sales (coming from 'coverage_revenue' table) but I need to use an ID column in another table ('table_b'). I understand I will need to use the RELATED function but not sure exactly where to use it.

 

The ID column exists in both tables (some IDs are missing from main table hence using the column from another table) and there is a relationship between both tables. 

 

The code is below, could someone help me with the correct usage of the RELATED function: the ID column that needs to change is 'Coverage Revenue'[RM_id] to ID column in another table.

 

Overall Percentile =

VAR SalesValue =

    [Total Sales]

RETURN

    IF(

        HASONEVALUE('Coverage Revenue'[RM_id]),

        COALESCE(

            DIVIDE(

               

                CALCULATE(

                    COUNTROWS('Coverage Revenue'),

                    FILTER(

                        ALL('Coverage Revenue'),

                        'Coverage Revenue'[Sum_NetRevPYFY] < SalesValue

                    )

                ),

               

                CALCULATE(

                    COUNTROWS('Coverage Revenue'),

                    ALL('Coverage Revenue')

                )

            ),

            0

        )

    )

 

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please show some sample data and expected result.

You could check the topic about How-to-Get-Your-Question-Answered-Quickly 

 

Best Regrds,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@Anonymous , related work in 1-M relationship to bring data from 1 side to M side

 

refer this, if this can help

Relatedtable, Related -https://youtu.be/Wu1mWxR23jU

Anonymous
Not applicable

Thanks for the video link, helped me understand a few things but have not resolved my problem. 

Turns out the relationship between the two tables cannot be created between the ID columns because of a many to many relationship (both tables with the ID column have duplicate IDs). Is there any other way I can use the ID column from tableB over tableA in my rankx measure?

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.