The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Cómo mostrar el nombre del producto como producto más vendido por categoría y mes
Ene | Feb | Marzo | ... | ... | ... | .. | ... | ... | |
Categoría X | Producto X | Producto Z | Producto X | Producto x | Producto z | Producto t | así sucesivamente | así sucesivamente | así sucesivamente |
Categoría Y | Producto y | Producto S | Producto z | Producto y | Producto o | Producto r | así sucesivamente | así sucesivamente | así sucesivamente |
Hice una matriz y muestra la multa total de ventas usando la siguiente medida
VAR RankingContext = VALORES ( DIM_WON_ANALYTICS[Producto] ) RETURN CALCULATE ( [Total Ventas], TOPN ( 1, ALL ( DIM_WON_ANALYTICS[Producto] ), [Total Ventas] ), RankingContext )
pero necesito mostrar el producto top 1 " Nombre "Estoy usando la siguiente medida pero devuelve los valores incorrectos.
FIRSTNONBLANK(TOPN(1,VALUES(DIM_WON_ANALYTICS[Product]),SUM(DIM_WON_ANALYTICS[Ingresos reales])),1)
Cómo puedo resolverlo
Hola, por favor pruébelo:
TopProduct =
VAR RankingContext = VALUES(DIM_WON_ANALYTICS[Producto])
VAR TopProductSales = CALCULATE([Total Sales], TOPN(1, ALL(DIM_WON_ANALYTICS[Product]), [Total Sales]), RankingContext)
DEVOLUCIÓN
FIRSTNONBLANK(FILTER(DIM_WON_ANALYTICS, [Total Sales] = TopProductSales), [Producto])
Esta medida primero calcula las ventas totales de cada producto en el contexto de la categoría y el mes, luego utiliza la función TOPN para devolver el producto con las ventas más altas. A continuación, utiliza la función FILTRO para devolver el primer nombre de producto que no está en blanco que coincida con las ventas del producto superior.
Si funciona, por favor acéptelo como una solución
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.