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

Obtener el primer día de los últimos 2 meses

Hola a todos

Actualmente tengo el siguiente DAX para obtener el primer día del último segundo mes. Quiero decir, cuando selecciono 4-Nov-2020 esto da fecha como 1-Oct-2020 que es correcto.

los últimos 2 meses - EDATE ( EOMONTH ( SELECTEDVALUE(Query1[STARTDATE] ), 0 ), -2 ) + 1

Pero cuando selecciono una fecha 25-Sep-2020 esto da fecha como 31-Jul-2020 en lugar de 1-Aug-2020.

Sé que este comportamiento es porque estamos agregando 1 día al final. Pero, ¿cómo puedo llegar al 1 de agosto de 2020?

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hola @LP280388 ,

Intente utilizar DATESBETWEEN para crear una medida así:

Measure =
CALCULATE (
    AVERAGE ( 'Table'[Value] ),
    ALL ( 'Table' ),
    DATESBETWEEN ( 'Table'[Date], [Last 2 month], [End of last month] )
)

Saludos

Icey

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@LP280388 ,

Inténtalo como

EOMONTH ( SELECTEDVALUE(Query1[STARTDATE] ), -2 )+ 1

Anonymous
Not applicable

@amitchandak agradece a Amit

Tengo otra pregunta con respecto a la misma fecha.

Necesito calcular el Promedio (factura) para el período entre estas dos medidas
Last 2 month á EOMONTH ( SELECTEDVALUE(Query1[STARTDATE] ), -2 )+ 1
Fin del mes pasado: EOMONTH (SELECTEDVALUE(Query1[STARTDATE]), 1 )
No puedo pasar estas fechas en la función DATESINPERIOD.
Por favor, ayúdame.
Icey
Community Support
Community Support

Hola @LP280388 ,

Intente utilizar DATESBETWEEN para crear una medida así:

Measure =
CALCULATE (
    AVERAGE ( 'Table'[Value] ),
    ALL ( 'Table' ),
    DATESBETWEEN ( 'Table'[Date], [Last 2 month], [End of last month] )
)

Saludos

Icey

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

Anonymous
Not applicable

@Icey Gracias Icey,

Lo intentaré hoy.

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.