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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Tamerlane
Helper I
Helper I

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])))

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors
Top Kudoed Authors