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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Columna calculada para el saldo por cliente en la línea de tiempo

Hola a todos,

Tengo una tabla con saldos de clientes en una línea de tiempo. Ahora quiero mostrar cómo se ha desarrollado el saldo a lo largo del tiempo, por cliente, en una columna calculada.

Por ejemplo, tengo esta tabla denominada CustomerTransactions:

Ficha de transición del cliente columna deseada

112 1-1-2020 500 500

112 1-5-2020 900 1400

112 4-5-2020 -200 1200

113 1-1-2020 400 400

113 2-5-2020 -900 -500

113 8-5-2020 300 -200

¿Alguien sabe cómo conseguir esta 'columna del deseo'? ¡Gracias!

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hola, @Tamerlane

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

Mesa:

d1.png

Puede crear una columna calculada o una medida como se indica a continuación.

Columna calculada:

Result Column = 
var _customer = [Customer]
var _transdate = [Transdate]
return
CALCULATE(
    SUM('Table'[Balance]),
    FILTER(
        ALL('Table'),
        'Table'[Customer]=_customer&&
        'Table'[Transdate]<=_transdate
    )
)

Medida:

Result Measure = 
var tab = 
ADDCOLUMNS(
    'Table',
    "Result",
    var _customer = [Customer]
    var _transdate = [Transdate]
    return
    CALCULATE(
        SUM('Table'[Balance]),
        FILTER(
            ALL('Table'),
            'Table'[Customer]=_customer&&
            'Table'[Transdate]<=_transdate
        )
    )
)
return
SUMX(
    tab,
    [Result]
) 

Resultado:

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

@Tamerlane

como nueva columna

Columna deseada, SUMX(filter(all(Table),Table[Transdate] <-earlier(Table[Transdate]) && Table[Customer] ?earlier(Table[Customer])),Sales[Balance])

Como nueva medida

Medida deseada: CALCULATE(SUM(Sales[Balance]),filter(all(Table),Table[Transdate] <-max(Table[Transdate]) && Table[Customer] -max(Table[Customer])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
parry2k
Super User
Super User

@Tamerlane comprobar este post.

Me gustaría elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!

Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionadas con Power BI.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.

Top Kudoed Authors