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
Zabeer
Helper I
Helper I

Rolling 12 meses de suma con dos filtros

Hola. Estoy luchando con una expresión dax particular por el problema de abajo. Me gustaría crear una columna calculada que proporcione la suma de 12 meses por cliente por categoría. Hay muchos más clientes y categorías.
Datos de muestra :

ClienteCategoríaFechaValorResultado esperado (acumulación de 12 meses)
AF01/01/20191010
AF01/02/2019212
AF01/03/2019719
AF01/04/2019423
AF01/05/2019326
AF01/06/2019430
AF01/07/2019535
AF01/08/2019237
AF01/09/2019643
AF01/10/2019346
AF01/11/2019147
AF01/12/2019552
AF01/01/2020244
AF01/02/2020850

3 REPLIES 3
dax
Community Support
Community Support

Hola @Zabeer ,

También podría referirse a la siguiente medida para ver si funciona o no

Measure =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date]
            > DATE ( YEAR ( MIN ( 'Table'[Date] ) ), MONTH ( MIN ( 'Table'[Date] ) ) - 12, 1 )
            && 'Table'[Date] <= MIN ( 'Table'[Date] )
    )
)

Saludos
Zoe Zhi

Si este post ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Mariusz
Community Champion
Community Champion

Hola @Zabeer

Puede utilizar DATESINPERIOD
https://docs.microsoft.com/en-us/dax/datesinperiod-function-dax

Consulte el ejemplo de DAX Mesure a continuación.

Sales Rolling 12 months = 
CALCULATE(
    [Sales],
    DATESINPERIOD( 'Calendar'[Date], MIN( 'Calendar'[Date] ) -1, -12, MONTH )
)

Saludos
Mariusz

Si este post ayuda,entonces por favor considere aceptarlo como la solución.

Por favor, siéntase libre de conectarse conmigo.
Linkedin

@Zabeer publicaciones similares en él y puede cambiarlo según las reglas de su negocio

https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/

https://www.accountingweb.co.uk/business/finance-strategy/power-bi-rolling-12-months-and-ytd



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