Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Ranking en tabla

Buenas tardes,

 

Estoy teniendo un problema con el tema del ranking que se plasman en tablas.

Utilizo la misma formula para calcular el ranking utilizando diferentes campos en cada formula

En la imagen siguiente se puede observar las formulas, el uso de las mimas y la mala funcionalidad que esta ocurriendo:

en la primer tablase esta utilizando en la formula "AccountDepartmenName" y como se ve en la tabla, funciona correctamente el ranking:

 

en la segunda metrica se utiliza "AccountDepartmenGroup" (es lo unico que cambia de la metrica) y cuando se plasma la medida en la tabla, el ranking no esta funcionando correctamente:

 

muestra 1 y 2 ....y no 1, 2, 3, 4 y 5 como deberia mostrar

 

los dos campos que se utilizan en las metricas son texto (AccountDepartmenName y AccountDepartmenGroup) , no tienen nada de diferencias.

Me podrian ayudar con este tema?

Gracias.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the reply from lbendlin , please allow me to provide another insight:

    Hi, Anonymous 
    Thanks for reaching out to the Microsoft fabric community forum.

     

    Based on my testing, I suspect that the R12ExpensesOverSales measure you provided might depend on the context of the AccountDepartmentName column and not on the AccountDepartmentGroup column. This also explains why lbendlin requested detailed data, as the R12ExpensesOverSales measure might lead to different sorting results depending on the context.

    Here is my test data:

     

    1.You can try applying the entire table directly within ALL() to see if it resolves the issue:

     

    m2 = 
    RANKX (
        ALLSELECTED ( 'dwDIM_AccountingAccounts' ),
        CALCULATE ( [R12ExpensesOverSales] ),
        ,
        ASC,
        DENSE
    )

     

    2.Alternatively, you can replace the RANKX() function with the RANK() function:

     

    m1 = 
    RANK (
        DENSE,
        ALL ( 'dwDIM_AccountingAccounts' ),
        ORDERBY ( 'dwDIM_AccountingAccounts'[R12ExpensesOverSales], ASC BLANKS FIRST ),
        DEFAULT
    )

     

    3.Here's my final result, which I hope meets your requirements.

    If you need more in-depth assistance, I recommend following lbendlin 's suggestion and sharing your PBIX file with us. This will allow us to better analyze the solution and conduct tests.When uploading a file, please be careful to delete sensitive information.

     

    Please find the attached pbix relevant to the case.

     

    Best Regards,

    Leroy Lu

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

     

2 Replies

  • Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.

    Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for the reply from lbendlin , please allow me to provide another insight:

    Hi, Anonymous 
    Thanks for reaching out to the Microsoft fabric community forum.

     

    Based on my testing, I suspect that the R12ExpensesOverSales measure you provided might depend on the context of the AccountDepartmentName column and not on the AccountDepartmentGroup column. This also explains why lbendlin requested detailed data, as the R12ExpensesOverSales measure might lead to different sorting results depending on the context.

    Here is my test data:

     

    1.You can try applying the entire table directly within ALL() to see if it resolves the issue:

     

    m2 = 
    RANKX (
        ALLSELECTED ( 'dwDIM_AccountingAccounts' ),
        CALCULATE ( [R12ExpensesOverSales] ),
        ,
        ASC,
        DENSE
    )

     

    2.Alternatively, you can replace the RANKX() function with the RANK() function:

     

    m1 = 
    RANK (
        DENSE,
        ALL ( 'dwDIM_AccountingAccounts' ),
        ORDERBY ( 'dwDIM_AccountingAccounts'[R12ExpensesOverSales], ASC BLANKS FIRST ),
        DEFAULT
    )

     

    3.Here's my final result, which I hope meets your requirements.

    If you need more in-depth assistance, I recommend following lbendlin 's suggestion and sharing your PBIX file with us. This will allow us to better analyze the solution and conduct tests.When uploading a file, please be careful to delete sensitive information.

     

    Please find the attached pbix relevant to the case.

     

    Best Regards,

    Leroy Lu

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