Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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_id | line_id | value_date | Actv_Flag |
| 400 | 321 | 5/15/2019 | Y |
| 400 | 321 | 5/15/2019 | Y |
| 400 | 303 | 5/13/2019 | Y |
| 400 | 303 | 5/13/2019 | Y |
| 100 | 222 | 4/9/2019 | Y |
| 100 | 222 | 4/9/2019 | Y |
| 100 | 221 | 4/9/2019 | Y |
| 100 | 221 | 4/9/2019 | Y |
| 100 | 202 | 4/1/2019 | Y |
| 100 | 202 | 4/1/2019 | Y |
| 608 | 553 | 4/10/2018 | Y |
| 608 | 553 | 4/10/2018 | Y |
| 608 | 552 | 6/26/2019 | Y |
| 608 | 552 | 6/26/2019 | Y |
| 608 | 551 | 6/26/2019 | Y |
| 608 | 551 | 6/26/2019 | Y |
Resultado esperado:
| statement_id | line_id | value_date | Actv_Flag | rango |
| 400 | 321 | 5/15/2019 | Y | 1 |
| 400 | 321 | 5/15/2019 | Y | 1 |
| 400 | 303 | 5/13/2019 | Y | 2 |
| 400 | 303 | 5/13/2019 | Y | 2 |
| 100 | 222 | 4/9/2019 | Y | 1 |
| 100 | 222 | 4/9/2019 | Y | 1 |
| 100 | 221 | 4/9/2019 | Y | 2 |
| 100 | 221 | 4/9/2019 | Y | 2 |
| 100 | 202 | 4/1/2019 | Y | 3 |
| 100 | 202 | 4/1/2019 | Y | 3 |
| 608 | 553 | 4/10/2018 | Y | 1 |
| 608 | 553 | 4/10/2018 | Y | 1 |
| 608 | 552 | 6/26/2019 | Y | 2 |
| 608 | 552 | 6/26/2019 | Y | 2 |
| 608 | 551 | 6/26/2019 | Y | 3 |
| 608 | 551 | 6/26/2019 | Y | 3 |
Gracias de antemano 🙂
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)
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])))
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.
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsIf you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.