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
Syndicate_Admin
Administrator
Administrator

PowerBI: calcular valores acumulativos con varios criterios

Hola Comunidad PowerBI.

He estado luchando con algo y agradecería algo de ayuda. Tengo una tabla con un conjunto de presupuestos y cifras de gastos reales por proyecto por mes. Estos se han incorporado a PowerBI. Ahora quiero calcular las cifras acumuladas / YTD para cada proyecto.

En la siguiente tabla tengo un ejemplo simplificado:

  • los proyectos son: Azul, Rojo
  • los Tipos son: Presupuesto, Actual
  • los meses son: ene, feb, mar y abril 2022
  • El nombre de la tabla es [MyTable]

| del proyecto Tipo | Mes | Cantidad || ¡Lo que quiero!
| azul | presupuestaria Ene 22 | US$ 50 || US$ 50
| azul | presupuestaria Feb 22 | US$ 50 || US$ 100
| azul | presupuestaria mar 22 | US$ 50 || US$ 150
| azul | presupuestaria abr 22 | US$ 50 || US$ 200
| azul | actual Ene 22 | US$ 40 || US$ 40
| azul | actual Feb 22 | US$ 65 || US$ 105
| azul | actual mar 22 | US$ 35 || US$ 140
| azul | actual abr 22 | US$ 40 || US$ 180
| rojo | presupuestaria Ene 22 | US$ 30 || US$ 30
| rojo | presupuestaria Feb 22 | US$ 30 || US$ 60
| rojo | presupuestaria mar 22 | US$ 30 || US$ 90
| rojo | presupuestaria abr 22 | US$ 30 || US$ 120
| rojo | actual Ene 22 | US$ 20 || US$ 20
| rojo | actual Feb 22 | US$ 25 || US$ 45
| rojo | actual mar 22 | US$ 45 || US$ 90
| rojo | actual abr 22 | US$ 32 || US$ 122

Puedo agregar una columna calculada usando lo siguiente:

Acumulativo = CALCULATE(SUM(MyTable[Amount]0, All(MyTable), MyTable[Month] <= EARLIER(MyTable[Month]))

Esto crea la columna, pero suma el valor para ambos / todos los proyectos.

¿Cómo obtengo el cálculo para filtrar el proyecto Y el tipo? La última columna de arriba muestra lo que estoy tratando de lograr.

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

@TIMBOP

por favor use

Cumulative =
VAR CuttentMonth = MyTable[Month]
RETURN
    CALCULATE (
        SUM ( MyTable[Amount] ),
        ALLEXCEPT ( MyTable, MyTable[Project] ),
        MyTable[Month] <= CuttentMonth
    )

Hola @tamerj1

Gracias.

He intentado esto. Obtengo valores acumulativos calculados, divididos por proyecto pero no (todavía) por tipo. ¿Es necesario añadir algo para lograrlo?

@TIMBOP

Por favor, utilice

Cumulative =
VAR CuttentMonth = MyTable[Month]
RETURN
    CALCULATE (
        SUM ( MyTable[Amount] ),
        ALLEXCEPT ( MyTable, MyTable[Project], MyTable[Type] ),
        MyTable[Month] <= CuttentMonth
    )

MUCHAS GRACIAS. ¡Eso funciona de maravilla! Muy apreciado.

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.