Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Tengo un conjunto de datos con una jerarquía y un valor, algo como esto:
Nivel 1 | Nivel 2 | Nivel 3 | Valor |
a | categoría 1 | clase 1 | 300 |
a | categoría 1 | clase 2 | 200 |
a | categoría 2 | clase 1 | 500 |
Necesito saber cómo podría ver el % respetado cada nivel dentro de un árbol de descomposición o matriz para mostrarlo en la misma columna.
Por ejemplo, si selecciono solo el nivel 1 y el nivel 3, tengo que mostrar el 80% para la clase 1, pero si selecciono los niveles 1 y 2 tengo que ver el 50% en la categoría 1.
¿Cómo pude conseguirlo?
Hola
Puede utilizar la función ISINSCOPE para calcularla:
Measure =
VAR A =
CALCULATE ( SUM ( 'Table'[Value] ), ALL ( 'Table' ) )
RETURN
IF (
ISINSCOPE ( 'Table'[Level 2] ),
IF (
ISINSCOPE ( 'Table'[Level 3] ),
SUM ( 'Table'[Value] ) / A,
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Level 2] IN DISTINCT ( 'Table'[Level 2] ) )
) / A
),
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Level 1] IN DISTINCT ( 'Table'[Level 1] ) )
) / A
)
Si este post ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Saludos
Dedmon Dai
@Pedro_R , remítame si esto puede ayudar
https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
1 | |
1 |