Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hola Comunidad,
Datos de muestra:
Productid | Viaje | Valor |
1 | 1 | 9 |
2 | 1 | 9 |
3 | 1 | 9 |
4 | 1 | 9 |
5 | 2 | 9 |
1 | 2 | 9 |
5 | 2 | 9 |
6 | 2 | 9 |
7 | 3 | 9 |
2 | 3 | 9 |
3 | 3 | 9 |
En una página de informe hay una segmentación de datos con "ProductId", si el usuario elige ProductId 2, entonces necesito identificar Trips que tiene este ProductId y sumar todo el valor de Trip.
Para ProductId 2 esto significaría Viaje número 1 y 3, lo que significa que la suma total sería 63 (Viaje 1 total + Viaje 2 total).
¿Se puede hacer esto con DAX?
@BIanon Tengo algo similar resuelto aquí Cómo anular la selección de segmentación de datos para devolver todos los registros | PeryTUS - Proc...
@BIanon ,
Sí, estoy seguro de que esto se puede hacer con una medida. Sin embargo, las variables y las tablas de variables no son mi fuerte. Voy a etiquetar a un par de personas que creo que pueden resolver esto con una medida.
@parry2k , @Jihwan_Kim - espero que pueda prestar una ayuda aquí.
Gracias y saludos,
Gracias por la respuesta.
¿Sería capaz de resolver esto con una medida en lugar de un col calculado?
@BIanon ,
Sí, DAX puede manejar esto. Yo me manejaría así. Cree 2 columnas calculadas:
Trip_Sum = CALCULATE( SUM(Products1[Value] ),
ALLEXCEPT( Products1, Products1[Trip] ))
ProductID_Sum = CALCULATE( SUM(Products1[Trip_Sum]),
ALLEXCEPT( Products1, Products1[ProductId] ))
Productid | Viaje | Valor | Trip_Sum | ProductID_Sum |
1 | 1 | 9 | 36 | 72 |
2 | 1 | 9 | 36 | 63 |
3 | 1 | 9 | 36 | 63 |
4 | 1 | 9 | 36 | 36 |
5 | 2 | 9 | 36 | 72 |
1 | 2 | 9 | 36 | 72 |
5 | 2 | 9 | 36 | 72 |
6 | 2 | 9 | 36 | 36 |
7 | 3 | 9 | 27 | 27 |
2 | 3 | 9 | 27 | 63 |
3 | 3 | 9 | 27 | 63 |
Con más tiempo, probablemente pueda hacer esto en un solo paso, pero esto le da más visibilidad a sus cálculos.
Espero que esto ayude.
Saludos
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.