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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

RANKX shows different result after using Union

Hello Community team,

 

I have a table name KPI with many measures behind, one of which is RANKX, which rankes the value based on a calculated measures before. The final purpose is to assign Score based on their rank.

All formula go well and shows the correct ranking and score as my logic.
However, to combin with other lists, I use UNION to append with other 2 tables, and the score goes wrong. I check details and assume that the Rank is the reason.
 
Could you please help to advise how I should set up the Rank to get the same result in the origin table and unioned table?
Thank you so much
 

 

 

EBIT_BOT = 
IF(
    [Ebit_lastest] <> 0, 
    RANKX(
        FILTER(
            ALLSELECTED(GC_Masterdata[Company Code], GC_Masterdata[Konzerngesellschaft Name]),
            [Ebit_lastest] <> 0
        ), 
        [EBIT_change], 
        ,
        ASC,
        Dense
    )
)


All = UNION(
    selectcolumns(GC_Masterdata,"Area",GC_Masterdata[Audit-Area], "Object",GC_Masterdata[Konzerngesellschaft Name], "Score", [GC_Score]),
    SELECTCOLUMNS(Process, "Area",Process[Audit-Area], "Object",Process[Konzerngesellschaft Name], "Score", Process[Process_Score]),
    SELECTCOLUMNS(Project, "Area",Project[Audit-Area], "Object",Project[Konzerngesellschaft Name], "Score", Project[Project_Score]),
)

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

Could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 

Best Regards

Zhengdong Xu
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

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous 

 

Could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello Zhengdong,

 

Thanks for your hints.

I have figured out with other work around, which help me to solve my problem.

So I will close this question.

 

Thank you.

mh2587
Super User
Super User

EBIT_BOT = 
IF(
    [Ebit_lastest] <> 0, 
    RANKX(
        FILTER(
            ALLSELECTED(GC_Masterdata[Company Code], GC_Masterdata[Konzerngesellschaft Name]),
            [Ebit_lastest] <> 0
        ), 
        [EBIT_change], 
        ,
        ASC,
        Dense
    )
)

All = UNION(
    SELECTCOLUMNS(GC_Masterdata, "Area", GC_Masterdata[Audit-Area], "Object", GC_Masterdata[Konzerngesellschaft Name], "Score", [EBIT_TOP], "Rank", [Rank_KPI]),
    SELECTCOLUMNS(Process, "Area", Process[Audit-Area], "Object", Process[Konzerngesellschaft Name], "Score", Process[Process_Score], "Rank", [Rank_Process]),
    SELECTCOLUMNS(Project, "Area", Project[Audit-Area], "Object", Project[Konzerngesellschaft Name], "Score", Project[Project_Score], "Rank", [Rank_Project])
)
//I just modified your measure but make sure to replace [Rank_KPI], [Rank_Process], and [Rank_Project] with the actual names of your calculated rank columns in each respective table.

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Anonymous
Not applicable

Hello Mr. Hasnain,

 

Actually the EBIT_BOT is rank already, so I don't need to add other collumns (Rank KPI). My problem is that EBIT_BOT measure gives me different result between the original table KPI, and unioned  table All.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.