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

Combinar tabla por sí misma

¡Hola a todos!

Quiero crear esta tabla. Combine una tabla con la misma tabla para crear una columna adicional que se base en dos claves: AccNum y Date.

table merge.png

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

Hola, @ft41

Según su descripción, creé datos para reproducir su escenario. El archivo pbix es attacehd al final.

Mesa:

d1.png

Puede crear una columna calculada como se muestra a continuación.

Result = 
var _lastvalue = 
CALCULATE(
    SUM('Table'[Total]),
    FILTER(
        'Table',
        'Table'[AccNum]=EARLIER('Table'[AccNum])&&
        'Table'[Date]=EARLIER('Table'[PreviousDate])
    )
)
return
COALESCE(_lastvalue,0)

Resultado:

d2.png

O puede crear una tabla calculada como se muestra a continuación.

NewTable = 
ADDCOLUMNS(
    'Table',
    "Result2",
    var _lastvalue = 
    CALCULATE(
        SUM('Table'[Total]),
        FILTER(
            'Table',
            'Table'[AccNum]=EARLIER('Table'[AccNum])&&
            'Table'[Date]=EARLIER('Table'[PreviousDate])
        )
    )
    return
    COALESCE(_lastvalue,0)
)

Resultado:

d3.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.

amitchandak
Super User
Super User

@ft41 , Puede hacerlo en una nueva columna usando

sumx(filter(table , [AccNum] á earlier([AccNum]) && [Date] á earlier([Date])),[Total])

Anonymous
Not applicable

La lógica es hacer una columna adicional que contiene los totales del mes anterior y luego restándolos encontrará la diferencia (es decir, el movimiento dentro del mes) con el fin de utilizarlo para otros cálculos.

Pragati11
Super User
Super User

Hola @ft41 ,

Sugiero hacer esto en el Editor de consultas de Power BI.

Duplica la tabla y elige Combinar para estas tablas.

Consulte el siguiente artículo sobre cómo combinar tablas en Power BI:

https://radacad.com/how-to-change-joining-types-in-power-bi-and-power-query

Gracias

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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.