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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DavideChamp
New Member

Crear columna o medida que convierta datos acumulados a datos mensuales específicos

Buenas,

tengo una base de datos con las cantidades de venta de 3 diferentes productos.

La tabla contiene datos mensuales acumulados, pero me gustaría extraer los datos mensuales específicos (por ejemplo, datos acumulados de febrero - datos acumulados de enero = datos específicos de febrero).

 

Las columnas de la tabla son: Tipo de Producto -- País de Origen -- País de Venta -- Año -- Mes -- Cantidad (Kg).

 

No sé si la mejor opción sería crear una nueva columna condicional o una nueva medida, pero en ambos casos no consigo que me devuelva la "Cantidad (Kg)" no acumulada.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DavideChamp 

 

If you don't have a date type column for month, you can first add a Month Start Date column in the table. For example with DAX:

Month Start = DATEVALUE([Year]&" "&[Month]&" 1")

 

Then create another calculated column with this DAX:

Monthly Qty =
'Table'[Quantity]
    - MAXX (
        FILTER (
            'Table',
            'Table'[Product Type] = EARLIER ( 'Table'[Product Type] )
                && 'Table'[Month Start] = EDATE ( EARLIER ( 'Table'[Month Start] ), -1 )
        ),
        'Table'[Quantity]
    )

vjingzhanmsft_0-1709004948990.png

 

If you want to add more conditions to above expression, use

Monthly Qty =
'Table'[Cantidad (Kg)]
    - MAXX (
        FILTER (
            'Table',
            'Table'[Tipo de Producto] = EARLIER ( 'Table'[Tipo de Producto] )
                && 'Table'[País de Origen] = EARLIER ( 'Table'[País de Origen] )
                && 'Table'[País de Venta] = EARLIER ( 'Table'[País de Venta] )
                && 'Table'[Month Start] = EDATE ( EARLIER ( 'Table'[Month Start] ), -1 )
        ),
        'Table'[Cantidad (Kg)]
    )

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @DavideChamp 

 

If you don't have a date type column for month, you can first add a Month Start Date column in the table. For example with DAX:

Month Start = DATEVALUE([Year]&" "&[Month]&" 1")

 

Then create another calculated column with this DAX:

Monthly Qty =
'Table'[Quantity]
    - MAXX (
        FILTER (
            'Table',
            'Table'[Product Type] = EARLIER ( 'Table'[Product Type] )
                && 'Table'[Month Start] = EDATE ( EARLIER ( 'Table'[Month Start] ), -1 )
        ),
        'Table'[Quantity]
    )

vjingzhanmsft_0-1709004948990.png

 

If you want to add more conditions to above expression, use

Monthly Qty =
'Table'[Cantidad (Kg)]
    - MAXX (
        FILTER (
            'Table',
            'Table'[Tipo de Producto] = EARLIER ( 'Table'[Tipo de Producto] )
                && 'Table'[País de Origen] = EARLIER ( 'Table'[País de Origen] )
                && 'Table'[País de Venta] = EARLIER ( 'Table'[País de Venta] )
                && 'Table'[Month Start] = EDATE ( EARLIER ( 'Table'[Month Start] ), -1 )
        ),
        'Table'[Cantidad (Kg)]
    )

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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