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

Marcar fecha si cae en los últimos 6 meses - Solo tener respuesta parcial

Hola

Tengo un problema simple y parece que no puedo resolverlo. Tengo información del año hasta la fecha que estoy mostrando, pero para algunas imágenes solo quiero mostrar los datos si caen en los 6 meses anteriores al mes anterior.

es decir, en septiembre, solo quiero mostrar datos entre febrero y julio. Y así sucesivamente...


Entiendo que necesitaré crear una medida para marcar todas las fechas que caen en esta línea de tiempo y esto es lo que estoy ha hecho.

Report_Month = IF(and(month(Date_Calendar[Date]) <= MONTH(today())-2,Month(Date_Calendar[Date]) >= MONTH(today())-7), 1,0)
Pero, cuando compruebo los datos, fallará una vez que las fechas comiencen a superponerse a los años ... ¿Hay alguna manera de modificar esto? o es una medida completamente diferente. Agradece cualquier ayuda
1 ACCEPTED SOLUTION

Gracias Amit, en realidad encontré una solución:

Report_Month =
var monthDiff = (YEAR(TODAY()) - YEAR(Date_Calendar[Date]))*12 + MONTH(TODAY()) - MONTH(Date_Calendar[Date])
return IF(monthDiff <= 1,"Últimos 2 meses",
IF(monthDiff < 8, "Último 6 meses",
IF(monthDiff <10,"Último 9 mes",
"más de un año")))
Pero usaré el tuyo también como referencia. Apreciarlo

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

@NOVICE02 , Pruebe una medida como con la ayuda de la tabla de fechas

Rolling 6 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ], eomonth(MAX('Date'[Date]), -1) ,-6,MONTH))

Gracias Amit, en realidad encontré una solución:

Report_Month =
var monthDiff = (YEAR(TODAY()) - YEAR(Date_Calendar[Date]))*12 + MONTH(TODAY()) - MONTH(Date_Calendar[Date])
return IF(monthDiff <= 1,"Últimos 2 meses",
IF(monthDiff < 8, "Último 6 meses",
IF(monthDiff <10,"Último 9 mes",
"más de un año")))
Pero usaré el tuyo también como referencia. Apreciarlo

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