Forum Discussion

smpa01's avatar
smpa01
Community Champion
5 months ago
Solved

Rank vs Rankx

AlexisOlson  I’m experimenting with the RANK window function vs. the traditional RANKX pattern. While I understand that RANK is now the recommended approach by SQLBI for performance and clarity,...
  • FBergamaschi's avatar
    FBergamaschi
    5 months ago

    Hi smpa01,
    I created the RANK version as follows

     

    dax_RANK =
    RANK (
        DENSE,
        ADDCOLUMNS(
        ALLSELECTED( 'fact' ),
        "@period", RELATED( dim_period[period] ),
        "@Mycol", [fact_sum]
        ),
        ORDERBY ( [@Mycol], DESC ),
        PARTITIONBY ( [@period] )
    )
     
    It works in my pbix both with a without the name in the visual
     

     

     

     

    If this helped, please consider giving kudos and mark as a solution

    @me in replies or I'll lose your thread

    Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

    Consider voting this Power BI idea

    Francesco Bergamaschi

    MBA, M.Eng, M.Econ, Professor of BI