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

Crear columna de rango basada en la agrupación y el orden por otra columna

Necesito crear una columna calculada que contendrá un valor de clasificación, pero esto se basará en varias columnas: Los datos de ejemplo son los siguientes: Necesito crear una columna Rank y su shoulbe agrupado por statment_id y ordenado por Line_id.

Ejemplo: Por statement_id 400 euros, line_id 321 debería obtener el rango 1, line_id 303 debería obtener el rango 2 por statement_id 100, line_id 222 debería obtener el rango 1, line_id 221 debería obtener el rango 221.

Datos de muestra:

statement_idline_idvalue_dateActv_Flag
4003215/15/2019Y
4003215/15/2019Y
4003035/13/2019Y
4003035/13/2019Y
1002224/9/2019Y
1002224/9/2019Y
1002214/9/2019Y
1002214/9/2019Y
1002024/1/2019Y
1002024/1/2019Y
6085534/10/2018Y
6085534/10/2018Y
6085526/26/2019Y
6085526/26/2019Y
6085516/26/2019Y
6085516/26/2019Y

Resultado esperado:

statement_idline_idvalue_dateActv_Flagrango
4003215/15/2019Y1
4003215/15/2019Y1
4003035/13/2019Y2
4003035/13/2019Y2
1002224/9/2019Y1
1002224/9/2019Y1
1002214/9/2019Y2
1002214/9/2019Y2
1002024/1/2019Y3
1002024/1/2019Y3
6085534/10/2018Y1
6085534/10/2018Y1
6085526/26/2019Y2
6085526/26/2019Y2
6085516/26/2019Y3
6085516/26/2019Y3

Gracias de antemano 🙂

3 REPLIES 3
harshnathani
Community Champion
Community Champion

Hola @HSubbaiah ,

en caso de que usted quiere crear un COlumn Calculado

RANKing Group = RANKX(FILTER('Table','Table'[statement_id] = EARLIER('Table'[statement_id])),'Table'[line_id],,DESC,DENSE)

1.jpg

En caso de que desee crear una medida

RANKing OrderId = RANKX(FILTER(ALL('Table'[statement_id],'Table'[line_id]), 'Table'[statement_id] = MAX('Table'[statement_id])),CALCULATE(SUM('Table'[line_id])))

1.jpg


saludos

Harsh Nathani


Apreciar con un Kudos!! (Haga clic en el botón Pulgares arriba)

¿He respondido a tu pregunta? ¡Marca mi puesto como una solución!

Hola que tal, como se podría aplicar la columna calculada que mostraste, pero para mas de un parametro? O sea que aplique un RANK pero segun otras cuatro columnas (por ejemplo en mi caso AÑO, TRIMESTRE, AGLOMERADO e INGRESO, y no solo una columna como la detallada.

¡Te agradezco de antemano! No encuentro por ningún lado esta solución.

MFelix
Super User
Super User

Hola @HSubbaiah ,

Cree la siguiente columna calculada en la tabla:

Rankin =
RANKX (
    FILTER ( 'Table'; 'Table'[statement_id] = EARLIER ( 'Table'[statement_id] ) );
    'Table'[line_id];
    ;
    DESC;
    DENSE
)


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.