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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Matti
Frequent Visitor

Combinar / Expandir dos tablas calculadas en una

Hola

Estoy intentando crear una tabla calculada que combine o expanda dos tablas calculadas en el mismo código DAX. Pero puede haber otra manera de hacerlo- editor de consultas (script M) no es una opción aquí.

Esto es lo que estoy tratando de hacer ilustrado en Excel. Necesito crear una tabla calculada con las combinaciones únicas de AccTree y ParrentKey.

Distinct Calculated table.PNG

Así que básicamente obtengo mis distintos AccTrees y los distintos ParrentKeys que van con los árboles en dos tablas calculadas separadas. Pero simplemente no puedo averiguar cómo fusionar los dos en una tabla - sin tener que calcular realmente dos tablas separadas y luego agregarlas en una tercera tabla calculada.

Distinct AccTree á SELECTCOLUMNS(SUMMARIZE(Acc,Acc[AccTree]),"AccTree",Acc[AccTree])

Distinta ParrentKey ( Distinct ParrentKey) CALCULATETABLE(DISTINCT(Acc[ParrentKey]),FILTER(ALL(Acc),Acc[AccTree]- [AccTree]))

Espero que alguien esté a la espera del desafío.

Gracias

Datos de ejemplo

AccidAccTreeParrentKey
11
211
311
412
512
12
221
321
422
923

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Matti , Pruebe una nueva mesa como

resume(filter(Table, not(isblank(Table[ParrentKey]))), Table[AccTree],Table[ParrentKey])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Matti
Frequent Visitor

Me las arreglé para resolver mi problema. Echa un vistazo a mi solución a continuación.

Resulta que GenerateAll era la función que estaba buscando.

GENERATEALL (

CALCULATETABLE (
SELECTCOLUMNS (
Acc),
"AccID, Acc[AccID],
"AccTree", Acc[AccTree])),
CALCULATETABLE(
DISTINCT(Acc[ParrentAccKey]),
FILTRO(
TODO (Acc),
Acc[AccTree]-[AccTree] && NOT(ISBLANK(Acc[ParrentAccKey])))))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Matti , Pruebe una nueva mesa como

resume(filter(Table, not(isblank(Table[ParrentKey]))), Table[AccTree],Table[ParrentKey])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak resolviste mi pregunta inicial, gracias!

Sin embargo, no lo he dicho muy bien ni proporcioné un ejemplo adecuado. Así que déjame intentarlo de nuevo.

Distinct Calculated table.PNG

Por lo tanto, para cada AccID, necesito agregar una fila para cada ParrentActKey único dentro de ese árbol de cuentas.

Ejemplo de datos proporcionados a continuación.

AccidAccTreeParrentAccID
111
21
31
414
51
61
71
828
92
10210
112
12312
133
143
153

¡Gracias!

Matti
Frequent Visitor

Me las arreglé para resolver mi problema. Echa un vistazo a mi solución a continuación.

Resulta que GenerateAll era la función que estaba buscando.

GENERATEALL (

CALCULATETABLE (
SELECTCOLUMNS (
Acc),
"AccID, Acc[AccID],
"AccTree", Acc[AccTree])),
CALCULATETABLE(
DISTINCT(Acc[ParrentAccKey]),
FILTRO(
TODO (Acc),
Acc[AccTree]-[AccTree] && NOT(ISBLANK(Acc[ParrentAccKey])))))

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Solution Authors