Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
jamuka
Advocate II
Advocate II

DATESYTD no funciona

Queridos todos,

Tengo un informe donde rastreo mis órdenes. Creé una tabla de calendario basada en mis fechas en mis datos y la marqué como una tabla de fechas.

Normalmente puedo calcular YTD como una medida, pero debido a las fechas de entrega de año nuevo mi calendario incluye fechas para 2021 y mi fórmula deja de funcionar. ¿Me pierdo algo o tengo que actualizar mi medida?

saludos

mi relación de tabla de datos y tabla de calendario se basa en "Fecha de entrega"

Date = VAR MinYear = Year (MIN('Fullfilment Report'[Created On]))
VAR MaxYear = Year (MAX('Fullfilment Report'[Delivery date]))
RETURN 
ADDCOLUMNS( FILTER ( CALENDARAUTO() , AND ( YEAR( [Date]) >= MinYear , YEAR ([Date]) <= MaxYear)) , 
"Year" , YEAR([Date]), 
"Month", MONTH([Date]),
"Month Name" , FORMAT([Date], "MMM"),
"Week Nr" , WEEKNUM([Date],2),
"Year Month" , FORMAT([Date], "YYYY.MM") )

mi medida YTD

YTD =
CALCULATE ( [New Fulfillment Rate2], DATESYTD ( 'Date'[Date] ) )

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

¿En qué contexto y objetos visuales está utilizando esto?

Usted puede cualquiera de los dos

OPCION A: actualice su fórmula para utilizar la referencia manual a TODAY(), como:

YTD =
CALCULATE ( [New Fulfillment Rate2], YEAR(FactTable[Date]) = YEAR(TODAY()))

o, OPTION B: agregue un contexto de año a su informe colocando un filtro de fecha en la página que tiene 2020 como el año máximo.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

6 REPLIES 6
v-janeyg-msft
Community Support
Community Support

Hola, @jamuka

Es un placer responder por ti.

De acuerdo con su descripción, No está muy claro dónde ocurren los problemas, pero se puede tratar de hacerlo sin función de inteligencia de tiempo.

Así:

YTD =
VAR d =
    MAX ( 'Date'[Date] )
RETURN
    CALCULATE (
        [New Fulfillment Rate2],
        FILTER (
            ALL ( 'Fullfilment Report' ),
            YEAR ( [Delivery Date] ) = YEAR ( d )
                && [Delivery Date] <= d
        )
    )

Si no resuelve su problema, por favor agregue más información y no dude en preguntarme.

Saludos

Janey Guo

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

Hola Janey,

lo siento por la respuesta tardía. gracias a Allison resolví mi problema.

Mi tabla de calendario tiene entradas de fecha para 2021 (debido a fechas de entrega) y calculé YTD en función de la fecha de entrega, por lo tanto, mi medida YTD devuelve valores en blanco. Agredo filtro de año a mi medida (que mostrará el año actual) y funciona.

Con su fomula muestra el mismo valor para cada entrada en mi tabla de matriz.

saludos

Hola, @jamuka

Sí, si agrega una segmentación de datos, puede intentar eliminar 'all' en mi fórmula anterior, y filtrará el año que elija.

Saludos

Janey Guo

Thanks Janey,

 

it works. 

AllisonKennedy
Super User
Super User

¿En qué contexto y objetos visuales está utilizando esto?

Usted puede cualquiera de los dos

OPCION A: actualice su fórmula para utilizar la referencia manual a TODAY(), como:

YTD =
CALCULATE ( [New Fulfillment Rate2], YEAR(FactTable[Date]) = YEAR(TODAY()))

o, OPTION B: agregue un contexto de año a su informe colocando un filtro de fecha en la página que tiene 2020 como el año máximo.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hola Allison,

lo siento por la respuesta tardía. gracias por su ayuda. ambas opciones funcionaron.

tener una buena semana.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors