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
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
If 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.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.