Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Estimados,
Quiero hacer una matriz de cliente (columnas) y articulo (filas). Tienen que aparecerme el top10 de cada una.
Puede ser que el cliente A sera el n° 5, y con el articulo 5° no tenga ninguna venta. En ese caso, me mostrara con valor 0. De esta forma vere oportunidades de mejora.
La pregunta es, como puedo hacer que las filas y columnas respeten el orden del ranking global?
Hay alguna visual que me de ordenes personalizados a las columnas y filas?
Desde ya gracias.
Sds.,
Solved! Go to Solution.
Hi @TesterDiseño ,
Thanks for reaching out to the Microsoft fabric community forum.
To sort a matrix in Power BI by each customer's total sales for the year 2022, start by creating a Calendar table and building a relationship with the Sales table using the Date column. Then, define a DAX measure to rank customers based on their 2022 sales using the formula:
Here is the DAX :
Rank 2022 = IF(ISINSCOPE(Sales[Customer]), RANKX(ALL(Sales[Customer]), CALCULATE(SUM(Sales[Sales Value]), 'Calendar'[Year] = 2022), , DESC, SKIP))
Add a matrix visual with Customer in Rows, Product in Columns (optional), and Sales Value in the Values area.
Include the Rank 2022 measure (either in Values or Tooltip), then sort the matrix by Rank 2022 in descending order. This approach displays customers ordered by their total sales in 2022, even if other slicers are applied
Please find the attached pbix file for your reference.
Best Regards,
Tejaswi.
Community Support
Hi @TesterDiseño ,
Thanks for reaching out to the Microsoft fabric community forum.
To sort a matrix in Power BI by each customer's total sales for the year 2022, start by creating a Calendar table and building a relationship with the Sales table using the Date column. Then, define a DAX measure to rank customers based on their 2022 sales using the formula:
Here is the DAX :
Rank 2022 = IF(ISINSCOPE(Sales[Customer]), RANKX(ALL(Sales[Customer]), CALCULATE(SUM(Sales[Sales Value]), 'Calendar'[Year] = 2022), , DESC, SKIP))
Add a matrix visual with Customer in Rows, Product in Columns (optional), and Sales Value in the Values area.
Include the Rank 2022 measure (either in Values or Tooltip), then sort the matrix by Rank 2022 in descending order. This approach displays customers ordered by their total sales in 2022, even if other slicers are applied
Please find the attached pbix file for your reference.
Best Regards,
Tejaswi.
Community Support
V-tejrama,
Thanks a lot for you answer.
Best regards.,
Hi @TesterDiseño ,
Just checking in have you been able to resolve this issue? If so, it would be greatly appreciated if you could mark the most helpful reply accordingly. This helps other community members quickly find relevant solutions.
Thank you.
Gracias por la respuesta. No es exactamente lo que busco. Paso un ejemplo para dar claridad.
En una matriz de 2000 clientes y 20.000 articulos.
Quiero sacar el top5 de cada uno y ver como participan entre si.
Datos de ejemplo:
| Ventas por Cliente (Ranking Global) | ||
| Ranking Global | Cliente | Venta |
| 1 | Juan | $ 100,00 |
| 2 | Pedro | $ 90,00 |
| 3 | Mario | $ 80,00 |
| 4 | Jose | $ 70,00 |
| 5 | Mario | $ 60,00 |
| Ventas por Articulo (Ranking Global) | ||
| Ranking Global | Articulo | Venta |
| 1 | Silla | $ 1.500,00 |
| 2 | Mesa | $ 950,00 |
| 3 | Ropero | $ 850,00 |
| 4 | Sillon | $ 710,00 |
| 5 | Cama | $ 600,00 |
Matriz a generar:
| Matriz | |||||
| Juan | Pedro | Mario | Jose | Mario | |
| Silla | $ 10,00 | $ 0,00 | $ 10,00 | $ 0,00 | $ 4,00 |
| Mesa | $ 8,00 | $ 0,00 | $ 5,00 | $ 0,00 | $ 5,00 |
| Ropero | $ 0,00 | $ 0,00 | $ 4,00 | $ 0,00 | $ 0,00 |
| Sillon | $ 12,00 | $ 0,00 | $ 0,00 | $ 0,00 | $ 0,00 |
| Cama | $ 0,00 | $ 0,00 | $ 0,00 | $ 20,00 | $ 1,00 |
Para hacer la matriz, tengo el detalle de como esta compuesta por articulo/cliente los valores que estan indicados en los ranking globales.
Necesito que en funcion de estos ranking globales, se ordenen las columnas y las filas. Va haber mas de una columna.
Inclusive, lo trataria de ver en una headmap para que visualmente se vean oportunidades de mejora. En las medidas nativas de power bi no encontre como hacerlo.
Desde ya muchas gracias por la ayuda.
Thanks for the clarification, This cannot be done natively with just Power BI's matrix visual as it doesn't allow dynamic TopN across both rows and columns simultaneously. may be you can try with possibly a custom visual you can achieve it.
custom charts like: xViz Heatmap, Deneb.
Deneb: Declarative Visualization in Power BI | Deneb
Hope the above information helps.
Proud to be a Super User! | |
Muchas gracias por la respuesta.
Probe con Deneb, pero me encontre con el siguiente inconveniente.
Creo una medida para ver el ranking total de cliente y de articulo, y cargo la misma en Denebe junto con las otras variables.
Cuando defino que clientes y articulos va mostrarme, si utilizo "||" me trae muchos mas de 10, me trae todos los de la seria. Si utilizo "&&" como separador, me trae solo 10, pero de existiir algun articulo del top10 que no se cruce con ningun cliente del top10, me lo saltea, lo excluye del ranking, por mas que forme parte de los 10 del ranking global. Lo mismo para con cliente, si tengo un cliente del rankin 10, que no ha comprado ninguno de los articulos del ranking 10, me lo exlcuye.
En la muestra de datos de ejemplo que pase, "Pedro" seria excluido con con el separador "&&" (and), me traeria otro, teniendo al mismo por inexistente por ser blank.
Si le pongo "||" (or) me traeria muchos mas registros.
Estuve dando vueltas en json y hasta busque mejorar el codigo con las IA, pero no consegui resolverlo. Tal vez si hubiera una forma en json de limitar los campos/filas que aparecen podria usarlo con "||", aunque tengo entendido que Deneb no lo permite.
Muchas gracias por la molestia.
Hi @TesterDiseño - Below are few of the solved threads and YT link:
Solved: Top N Within Matrix Table - Microsoft Fabric Community
Power BI: Dynamically top N rank for multiple columns in the matrix using RANKX, SWITCH & ISINSCOPE
Hope this helps.
Proud to be a Super User! | |
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 63 | |
| 62 | |
| 42 | |
| 20 | |
| 18 |