Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hola a todos
Tengo esta pregunta en una entrevista reciente y quiero comprobar con usted el DAX correcto.
La pregunta era escribir un DAX usando SUMX - Supongamos que tenemos múltiples medidas (Ganancias, Ventas,..) y 2 dimensiones (Productos, Regiones). Si seleccionamos ganancias, debe mostrar solo los números de ganancias para productos y regiones, de manera similar, si seleccionamos Ventas, debe mostrar solo los números de ventas para productos y regiones,
Por favor, ayúdenos con el DAX.
-- Mesa de corte
SlicerTable =
TABLA DE DATOS(
"NombreDeMedida",
CUERDA
{
{"Ganancia"},
{"Ventas"}
}
)
--Medidas
Beneficio = SUMA('FactTable'[Ganancia])
Ventas = SUMA('FactTable'[Ventas])
-- Medida dinámica
MedidaSeleccionada =
VAR SelectedValue = SELECTEDVALUE('SlicerTable'[MeasureName])
DEVOLUCIÓN
INTERRUPTOR(
VERDADERO(),
SelectedValue = "Ganancia", [Ganancia],
SelectedValue = "Ventas", [Ventas]
)
-- Medida de visualización
MedidaPantalla =
SUMX(
VALUES('DimensionTable'[Producto]),
[MedidaSeleccionada]
)
Vote for your favorite vizzies from the Power BI World Championship submissions!
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.