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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jimmy69
Frequent Visitor

Nueva tabla resumen a partir de otra

Hola, soy usuario principiante y quiero hacer una tabla siguiente con una condicion de gastos:

Tabla actual "Dades2024"

Id de usuarioEneroFebreroMarzo
23423430300
435454053
23432415300

 

la nueva tabla "Gastos2024"

Id de usuarioEneroFebreroMarzoacumulado añoForfaitSaldo
2342343030060500
43545405348502
2343241530045505

La idea es crear una tabla que me calcule el coste acumulativo de cada mes, pero si en el mes de marzo ha superado 50€ debera crear una "alarma" para pagar al Usuario 50€ y el resto de año no se le pagara nada mas.

Código:

Resumen = 

VAR Tabla = SUMMARIZE(

  dades2024,

  dades2024[ID de usuario],

  dades2024[Mes],

  "Gasto mensual", SUM(dades2024[Preu (fins 14 min)])

)

VAR Acumulado = 

  ADDCOLUMNS(

    Tabla,

    "Acumulado",

    CALCULATE(

      SUMX(

        FILTER(

          Tabla,

          dades2024[Mes] <= EARLIER(dades2024[Mes])

        ),

        dades2024[Preu (fins 14 min)]

      )

    )

  )

RETURN

  ADDCOLUMNS(

    Tabla,

    "Gasto mensual acumulado", [Acumulado],

    "Supera 80€", IF([Acumulado] >= 80, 1, 0)

  )

 

Necesito una ayuda.

 

Gracias

 

 

 

 

1 ACCEPTED SOLUTION
v-jialongy-msft
Community Support
Community Support

Hi @jimmy69 

 

You can use the following measure to get the cumulative amount for the previous three months.

Accumulate = SELECTEDVALUE('Table 2'[Jan])+SELECTEDVALUE('Table 2'[Feb])+SELECTEDVALUE('Table 2'[Mar])

 

You can use the following measure to get the amount you get.

Measure = IF('Table 2'[Accumulate]>50,0,50-'Table 2'[Accumulate])

 

This is the result you want.

vjialongymsft_0-1710381552818.png

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jialongy-msft
Community Support
Community Support

Hi @jimmy69 

 

You can use the following measure to get the cumulative amount for the previous three months.

Accumulate = SELECTEDVALUE('Table 2'[Jan])+SELECTEDVALUE('Table 2'[Feb])+SELECTEDVALUE('Table 2'[Mar])

 

You can use the following measure to get the amount you get.

Measure = IF('Table 2'[Accumulate]>50,0,50-'Table 2'[Accumulate])

 

This is the result you want.

vjialongymsft_0-1710381552818.png

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.