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

Valor del mes anterior AAAAMM

Queridos todos,

Tengo la siguiente tarea que amablemente les pido que me ayuden con:

columna YYYYMM , valores a lo largo de meses

La columna AAAAMM está separada de la fecha.

Quiero calcular el valor del mes anterior YYYYMM-1 y mostrarlo en el gráfico

El mes PREVIOUS no me ayuda como basado en la fecha

chart10.jpg

Gracias

1 ACCEPTED SOLUTION

HI @alextarki,

Puede probar esta fórmula de medida si cumple con sus requisitos:

Measure =
VAR currYM =
    MAX ( Table[YearMonth] )
VAR prevDate =
    DATE ( LEFT ( currYM, 4 ), RIGHT ( currYM, 2 ) - 1, 1 )
VAR prevYM =
    YEAR ( prevDate ) * 100
        + MONTH ( prevDate )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER ( ALLSELECTED ( Table ), [YearMonth] = prevYM )
    )

saludos

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

¿Funcionó esto para alguien? He probado la definición de medida sugerida exactamente, pero sigo obteniendo BLANKs durante todos los meses. He estado buscando sobre esto durante un par de días. No estoy en usar PREVIOUSMONTH() porque no tengo una columna de fecha adecuada con fechas contiguas.

az38
Community Champion
Community Champion

@alextarki hola

mes anterior se puede encontrar como

DATE(LEFT([Column], 4), RIGHT([Column], 2)-1, 1)


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Gracias

¿Cómo puedo crear todo el valor del mes anterior?

HI @alextarki,

Puede probar esta fórmula de medida si cumple con sus requisitos:

Measure =
VAR currYM =
    MAX ( Table[YearMonth] )
VAR prevDate =
    DATE ( LEFT ( currYM, 4 ), RIGHT ( currYM, 2 ) - 1, 1 )
VAR prevYM =
    YEAR ( prevDate ) * 100
        + MONTH ( prevDate )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER ( ALLSELECTED ( Table ), [YearMonth] = prevYM )
    )

saludos

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help 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.

Top Solution Authors
Top Kudoed Authors