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

Informe del mes anterior Total con un filtro de fecha relativa en este año. ¡Estoy muerto de cerebro!

La mayoría de los informes que tenemos utilizan filtros de fecha relativa. YTD, MTD y otras medidas de retrospectado están todas escritas.

Ahora quieren el año anterior Total Month en un informe junto con MTD, YTD, etc.

Sólo encontré una pregunta que estaba cerca, pero la respuesta fue incorrecta (entregado Prior YTD). Todas las demás respuestas suponen que una fecha está en el Visual.

Mesas

Completa la tabla Calendario que incluye el Mes Fiscal (número). Enlaces de calendario a Ventas vía fecha.

La tabla de ventas solo tiene fechas en el pasado y para fechas con ventas, por lo que faltan fechas.

Por favor y gracias por ayudar con este simple problema. Doy Kudos y marca como resuelto!

1 ACCEPTED SOLUTION

@ScubaBob

Pruebe lo siguiente:
(Para este ejemplo estoy usando una simple [suma de ventas]

Sales YTD = TOTALYTD([Sum of Sales], 'Calendar Table'[Date])

1) Es noviembre de 2020. Necesito ventas totales de noviembre para noviembre de 2019

Previous Year Sales (current month) = 
VAR Calc = CALCULATE([Sum of Sales], 
               FILTER(DATEADD('Calendar Table'[Date], -1,YEAR), 
                MONTH('Calendar Table'[Date]) = MONTH(TODAY())))
RETURN
IF(MAX('Calendar Table'[Year]) = YEAR(TODAY()), Calc)

2) Necesito ventas totales anuales de 2019 hasta noviembre

Previous YTD (current month cut-off) = 
VAR Calc = CALCULATE([Sales YTD], 
            FILTER(DATEADD('Calendar Table'[Date], -1, YEAR),   
                MONTH('Calendar Table'[Date]) <= MONTH(TODAY())))
RETURN
IF(MAX('Calendar Table'[Year]) = YEAR(TODAY()), Calc)





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@ScubaBob , si usted fecha (fecha o fecha relativa) entonces usted debe ser capaz de utilizar datesytd

-- aquí 12/31 es mi fin de año, puedes reemplazar con tu fin de año. Es indicativo, no trate esto como fecha de finalización

Ventas YTD á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

o una medida como

Año detrás de Ventas: CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Forzar YTD cuando la fecha no está allí. Pero en ese caso el calendario debe terminar en este año

YTD QTY forced= 
var _max = today()
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESYTD('Date'[Date])), blank())
//or
//calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date','Date'[Date]<=_max))
//calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))



LYTD QTY forced= 
var _max = date(year(today())-1,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)

Power BI — Año tras año con o sin inteligencia de tiempo
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

Anonymous
Not applicable

@amitchandak

@PaulDBrown Tal vez sepas esto. Parece ser difícil.

Le diste fórmulas ATD. Tengo todos esos construidos. Necesito el total del mes del año anterior para el mes actual y el total del año anterior hasta el mes actual.

1) Es noviembre de 2020. Necesito ventas totales de noviembre para noviembre de 2019

2) Necesito ventas totales anuales de 2019 hasta noviembre

@ScubaBob

Pruebe lo siguiente:
(Para este ejemplo estoy usando una simple [suma de ventas]

Sales YTD = TOTALYTD([Sum of Sales], 'Calendar Table'[Date])

1) Es noviembre de 2020. Necesito ventas totales de noviembre para noviembre de 2019

Previous Year Sales (current month) = 
VAR Calc = CALCULATE([Sum of Sales], 
               FILTER(DATEADD('Calendar Table'[Date], -1,YEAR), 
                MONTH('Calendar Table'[Date]) = MONTH(TODAY())))
RETURN
IF(MAX('Calendar Table'[Year]) = YEAR(TODAY()), Calc)

2) Necesito ventas totales anuales de 2019 hasta noviembre

Previous YTD (current month cut-off) = 
VAR Calc = CALCULATE([Sales YTD], 
            FILTER(DATEADD('Calendar Table'[Date], -1, YEAR),   
                MONTH('Calendar Table'[Date]) <= MONTH(TODAY())))
RETURN
IF(MAX('Calendar Table'[Year]) = YEAR(TODAY()), Calc)





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






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.

Top Kudoed Authors