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
Syndicate_Admin
Administrator
Administrator

recuento inicial (hace 12 meses)

Hola

Estoy tratando de obtener el recuento inicial de hace 12 meses y debería ser dinámico realizar cálculos de R12. Por ejemplo:

Recuento final = Oct'21
Recuento inicial = Nov'20

Necesito ayuda para obtener el recuento inicial. ¿Alguna sugerencia?

Saludos
Mahesh

1 ACCEPTED SOLUTION

HAY @Maheshguptaz

Prueba esto:

R12 Start number =
VAR _EndDate =
    MAX ( 'Calendar'[Date] )
VAR _StartDateS =
    DATE ( YEAR ( _EndDate ) - 1, MONTH ( _EndDate ) - 1, 1 )
VAR _StartDateF =
    ENDOFMONTH ( _StartDateS )
RETURN
    CALCULATE (
        COUNTA ( ExcelDB_Headcount[Employee ID] ),
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] >= _StartDateS
                && 'Calendar'[Date] <= _StartDateF
        )
    )

Si esta publicación ayuda,considere aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.

Aprecia tus felicitaciones!!

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

Hay @Maheshguptaz

Puede usar Edate() o Eomonth(),

https://docs.microsoft.com/en-us/dax/edate-function-dax

https://docs.microsoft.com/en-us/dax/eomonth-function-dax

P. ej...

Start Date = 
    VAR _date= MAX('DATE Table'[Date]) //in this example, max date in table is 2021/10/21
    var _start=EDATE(_date,-12)
RETURN _start

vxiaotang_1-1636608856751.png

Start Date = 
    VAR _date= MAX('DATE Table'[Date]) //in this example, max date in table is 2021/10/21
    var _start=EOMONTH(_date,-12)
RETURN _start


vxiaotang_2-1636608876293.png

Saludos

Equipo de soporte de la comunidad _Tang

Si esta publicación ayuda,considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.

Syndicate_Admin
Administrator
Administrator

Hay @Maheshguptaz

Puede utilizar la función PREVIOUSYEAR DAX para encontrar la solución.

Si esta publicación ayuda,considere aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.

Aprecia tus felicitaciones!!

Hola @VahidDM ,

Obtengo el total de los últimos 12 meses si uso el siguiente DAX:

R12 Número de inicio = CALCULAR(COUNTA(ExcelDB_Headcount[ID de empleado]),AÑO ANTERIOR('Calendario'[Fecha]))
Estoy tratando de obtener solo el recuento para un solo mes.


HAY @Maheshguptaz

Prueba esto:

R12 Start number =
VAR _EndDate =
    MAX ( 'Calendar'[Date] )
VAR _StartDateS =
    DATE ( YEAR ( _EndDate ) - 1, MONTH ( _EndDate ) - 1, 1 )
VAR _StartDateF =
    ENDOFMONTH ( _StartDateS )
RETURN
    CALCULATE (
        COUNTA ( ExcelDB_Headcount[Employee ID] ),
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] >= _StartDateS
                && 'Calendar'[Date] <= _StartDateF
        )
    )

Si esta publicación ayuda,considere aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.

Aprecia tus felicitaciones!!

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.