Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Visualización de matriz padre-hijo con el elemento primario como primera fila secundaria

Dada la siguiente tabla

IdIdentificación de los padresCantidadCamino
1 101
21201 x 2
31301 x 3
42401 x 2 x 4
52501 x 2 x 5

Quiero crear una visualización padre-hijo mediante la matriz en Power BI.

Actualmente usando el método DAX PATH y PATHITEM Tengo esto:

Importe de identificación

1 150

2 110

4 40

5 50

3 30

¿Es posible tener:

Importe de identificación

1 150

1 10

2 110

2 20

4 40

5 50

3 30

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hola, @pniang

Según su descripción, creé datos para reproducir su escenario. El archivo blix se adjunta al final.

Mesa:

b1.png

Puede crear columnas calculadas como se muestra a continuación.

Path = PATH('Table'[ID],'Table'[Parent ID])
Level1 = PATHITEM('Table'[Path],1,TEXT)
Level2 = 
var _level2 = PATHITEM('Table'[Path],2,TEXT)
return
IF(
    PATHITEM('Table'[Path],2,TEXT)="",
    [Level1],
    _level2
)
Level3 = 
var _level3 = PATHITEM('Table'[Path],3,TEXT)
return
IF(
    _level3="",
    IF(
        [Level2]="",
        [Level1],
        [Level2]
    ),
    _level3
)

Resultado:

b2.png

Saludos

Allan

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hola, @pniang

Según su descripción, creé datos para reproducir su escenario. El archivo blix se adjunta al final.

Mesa:

b1.png

Puede crear columnas calculadas como se muestra a continuación.

Path = PATH('Table'[ID],'Table'[Parent ID])
Level1 = PATHITEM('Table'[Path],1,TEXT)
Level2 = 
var _level2 = PATHITEM('Table'[Path],2,TEXT)
return
IF(
    PATHITEM('Table'[Path],2,TEXT)="",
    [Level1],
    _level2
)
Level3 = 
var _level3 = PATHITEM('Table'[Path],3,TEXT)
return
IF(
    _level3="",
    IF(
        [Level2]="",
        [Level1],
        [Level2]
    ),
    _level3
)

Resultado:

b2.png

Saludos

Allan

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Anonymous
Not applicable

Gracias @v-alq-msft eso es lo que quería hacer.

Sólo una última cosa es posible evitar repetir el nodo "1" tres veces?

(-)1

1

En lugar de

(-)1

(-)1

1

amitchandak
Super User
Super User
Anonymous
Not applicable

Gracias @amitchandak por su respuesta, pero en mi caso no tengo padres mutliple, cuando desdondo un nodo primario sólo quiero mostrar el nodo primario entre los nodos secundarios, porque el nodo primario tiene su propia "cantidad" para mostrar.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.