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

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

Reply
Dog
Responsive Resident
Responsive Resident

RANKX not return true rank value when performed on a calculated column

Hi All, 

 

I am currently using RANKX to perform ranks dynamically depending on whether or not the end user has drill down through on a bar chart visual

 

I am using the following switch statement (section posted below) to check filtered context from a slicer and drill through filtering.

This statement works as I want but the issue relates to the returned values from the RANKX function, two the of three fields that are being used for ranking are calculated columns and are return 1’s for each rank, whereas the “CoreNominal Title” field is a fixed data field and returns the correct ranking values.

 

Thanks


Dog

 

SWITCH (

            ContFilter,

            "Actual year to date vs Budget year to date",

                IF (

                [IncomeNActualYTDvsBudgetYTD] < 0,

                IF (

                    ISFILTERED ( Nominals[SplitReportGrouping] ),

                    RANKX (

                        FILTER ( ALL ( Nominals[SplitReportGrouping] ), [IncomeNActualYTDvsBudgetYTD] ),

                        [IncomeNActualYTDvsBudgetYTD],

                        ,

                        ASC,

                        DENSE

                    ),

                    IF (

                        ISFILTERED ( Nominals[Management Title] ),

                        RANKX (

                            FILTER ( ALL ( Nominals[Management Title] ), [IncomeNActualYTDvsBudgetYTD] ),

                            [IncomeNActualYTDvsBudgetYTD],

                            ,

                            ASC,

                            DENSE

                        ),

                        IF (

                            ISFILTERED ( Nominals[CoreNominal Title] ),

                            RANKX (

                                FILTER ( ALL ( Nominals[CoreNominal Title] ), [IncomeNActualYTDvsBudgetYTD] ),

                                [IncomeNActualYTDvsBudgetYTD],

                                ,

                                ASC,

                                DENSE

                            ),

                            BLANK ()

                        )

                    )

                ),

                BLANK ()

            )

1 REPLY 1
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Dog,

 

Not clear about your table structure, so I was unable to replicate your scenario. I used below measure formula which returns correct rank values dynamically basaed on slicer.

 

Rank measure= 
RANKX (
    ALLSELECTED ( Nominals),
    LASTNONBLANK ( Nominals[IncomeNActualYTDvsBudgetYTD], 1 ),
    ,
    ASC,
    DENSE
)

 

For more advice, please share some sample data and report design and all necessary formulas of measure/calculated column so that I can test for you.

 

Regards,
Yuliana Gu

 

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors