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
Anonymous
Not applicable

Calcular la suma de los últimos 12 meses (incluye el mes actual) del mes seleccionado

Hola

Estoy tratando de calcular la suma de las transacciones de los últimos 12 meses a partir del mes fiscal seleccionado como se muestra en la siguiente captura de pantalla. Por ejemplo, para calcular el importe de mayo de 2020, debería sumar el importe durante 12 meses a partir de junio de 2019 a mayo de 2020.

Inventory_Pivot.png

He utilizado la siguiente función DAX y se está sumando correctamente para los meses anteriores y no funciona bien para el mes actual.

Resultado ?
Var
last_date de la última fecha('Hecho'[FECHA])
devolución
CALCULATE(sum('Fact'[AMOUNT]),
FECHASINPERIOD('Calender'[Fecha],last_date,-12,MES)
)

Por favor, cualquiera me ayude a lograrlo.

Gracias

Nivetha P

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hola @SKITS_2020 ,

¿Qué tal el resultado después de seguir las sugerencias mencionadas en mi publicación original? ¿Podría proporcionar más detalles al respecto si no cumple con su requisito?


Saludos

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hola @SKITS_2020 ,

Creamos un simple y su medida funciona bien, ¿cuál es la relación entre sus tablas?

4.jpg

2.jpg3.jpg

También puede intentar utilizar la siguiente fórmula:

Result =
VAR last_date =
    MAX ( 'Fact'[DATE] )
RETURN
    CALCULATE (
        SUM ( 'Fact'[AMOUNT] ),
        ALLSELECTED (),
        'Fact'[DATE] <= last_date,
        'Fact'[DATE]
            >= DATE ( YEAR ( last_date ) - 1, MONTH ( last_date ) + 1, 1 )
    )


Por cierto, pbIX archivo como adjunto.


Saludos

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Vea si mi Inteligencia del Tiempo el Camino Duro proporciona una manera diferente de lograr lo que usted está buscando.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
vanessafvg
Super User
Super User

¿Qué obtienes para el mes actual?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.