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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Syndicate_Admin
Administrator
Administrator

Combinar dos columnas de diferentes tablas en la instrucción SUMMARIZE()

Hola a todos,

Necesito crear una medida que tenga una tabla virtual que combine 2 columnas de dos tablas diferentes. Ahora mismo solo tengo el dax para combinar dos columnas de la misma tabla en la función summarize:

FUERON table_0 =
ADDCOLUMNS(
CALCULABLETABLE(
RESUMIR(
DIM_TERRITORIO_NO_RLS
,DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL2]
,DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL1]
), ELIMINAR FILTROS(DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL1]), ELIMINAR FILTROS(DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL2]), DIM_TERRITORIO_NO_RLS[TERR_LINEA] = "G")
, "CM GER"
,CALCULAR([CM% GER2 NO_RLS]
,ELIMINAR FILTROS(DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL1_FILTER], DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL2_FILTER])
,ELIMINAR FILTROS(DIM_GEO_NO_RLS[DES_GEONIVEL3_FILTER], DIM_GEO_NO_RLS[DES_GEONIVEL4_FILTER]) )
, "CM TU"
,CALCULAR([CM% TU NO_RLS]
,ELIMINAR FILTROS(DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL1_FILTER], DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL2_FILTER])
,ELIMINAR FILTROS(DIM_GEO_NO_RLS[DES_GEONIVEL3_FILTER], DIM_GEO_NO_RLS[DES_GEONIVEL4_FILTER]) )
)
Sé que es un poco largo y complicado, pero esencialmente, estoy tomando las columnas DES_TERRNIVEL1 y DES_TERRNIVEL2 (ambas de la tabla DIM_TERRITORIO_NO_RLS), colocándolas en una tabla virtual y agregando dos compases con un puñado de filtros.
Ahora, sin embargo, necesito combinar DES_TERRNIVEL2 y la columna DES_GEONIVEL2 que proviene de la tabla DIM_GEO_NO_RLS, ya que quiero ver los valores de la medida de DES_GEONIVEL2 dentro de DES_TERRNIVEL2. Para contextualizar: las columnas siguen una jerarquía: DES_TERRNIVEL2 es el estado, DES_TERRNIVEL1 es el condado y DES_GEONIVEL2 es la ciudad. Entonces, para este ejemplo, necesito ver los valores de las ciudades dentro de los estados a los que pertenecen.
¡Realmente agradecería cualquier tipo de ayuda!
Probé este dax por ahora pero no está funcionando:
FUERON table_0 =
ADDCOLUMNS(
CALCULABLETABLE(
GENERAR(RESUMIR(
DIM_TERRITORIO_NO_RLS
,DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL2]), SELECTCOLUMNS(TABLA RELACIONADA(DIM_GEO_NO_RLS), "Ciudad", DIM_GEO_NO_RLS[DES_GEONIVEL2])
), ELIMINAR FILTROS(DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL1]), ELIMINAR FILTROS(DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL2]), DIM_TERRITORIO_NO_RLS[TERR_LINEA] = "B")
, "CM Enoxa"
,CALCULAR([CM% Hibor TTO 3M Informe no_rls Felipe]
,ELIMINAR FILTROS(DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL1_FILTER], DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL2_FILTER])
,ELIMINAR FILTROS(DIM_GEO_NO_RLS[DES_GEONIVEL3_FILTER], DIM_GEO_NO_RLS[DES_GEONIVEL4_FILTER]) ))
3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Hola @felipereyes_ ,

Puede RESUMIR una tabla también basándose en las columnas de otra tabla, si la otra tabla está en el lado "1" de una relación 1-Muchos.

Solo 1 consejo: Si proporcionas código en tu publicación, formatea el código e insértalo a través del cuadro "Insertar/Editar muestra de código". Esto permitirá a los usuarios leer y comprender su código mucho más fácilmente.

Br

Hola Manuel, gracias por tu respuesta. Sin embargo, la tabla DIM_GEO_NO_RLS está en el lado "muchos" de la relación 1-muchos, ya que tiene todas las ciudades que pertenecen a los estados individuales que están en DIM_TERRITORIO_NO_RLS. Intenté hacerlo así pero no funciona:

RESUMIR(
DIM_TERRITORIO_NO_RLS
,DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL2]
,DIM_GEO_NO_RLS[DES_GEONIVEL2]
)
¿Tienes alguna sugerencia de cómo podría funcionar?

¿Por qué no intentarlo?

SUMMARIZE (
    DIM_GEO_NO_RLS,
    DIM_TERRITORIO_NO_RLS[DES_TERRNIVEL2],
    DIM_GEO_NO_RLS[DES_GEONIVEL2]
)

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.