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
Raulx_7
Helper I
Helper I

El año pasado a partir de la fecha máxima

Hola, estaba haciendo algunos cálculos, y en este utilizo un filtro para seleccionar la fecha máxima:

fecha: MAX(Fecha[Fechas]),

Ahora necesito el valor de la misma fecha, pero en el último año, he intentado con

Fecha:  SAMEPERIODLASTYEAR (MAX(Fecha[fechas]))

Pero me da un error con las fechas

¿Hay alguna manera de resolver esto o necesito desarrollar otra solución

1 ACCEPTED SOLUTION
jbirco
Resolver I
Resolver I

puede probar 'lydate ? MAX(Date[Dates])-365' o puede probar la función DATEADD

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Tengo el mismo problema y no puedo hacer que funcione.

El mismo año no funciona. OpenCurrentYTD es correcto

OpenCurrentYTD =

Var Segmentvar = AllSELECTED(WorkersComp[Segment])

var divisionvar = allSELECTED(WorkersComp[subsegmento])

Devolución

CALCULATE(Count(WorkersComp[Solvinjury ID]),WorkersComp[Segment] in Segmentvar,WorkersComp[Sub-Segment]in Divisionvar,

Filter(ALL(WorkersComp),( WorkersComp[InclusiveStatus]="Yes" && WorkersComp[DateSubmittedME] <= max('Calendar'[Date]) && WorkersComp[DateSubmittedME] <> Blank() && (('WorkersComp'[ClosedME] = Blank()) || WorkersComp[ClosedME] > max('Calendario'[Fecha]) ))))

Intentó

PrevPeriod =

Var Segmentvar = AllSELECTED(WorkersComp[Segment])

var divisionvar = allSELECTED(WorkersComp[subsegmento])

Var PrevPMax = EOMONTH(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),-12)

Devolución

CALCULATE(Count(WorkersComp[Solvinjury ID]),WorkersComp[Segment] in Segmentvar,WorkersComp[Sub-Segment]in Divisionvar,

Filter(ALL(WorkersComp),(WorkersComp[InclusiveStatus]="Yes" && WorkersComp[DateSubmittedME] <=PrevPMax && WorkersComp[DateSubmittedME] <> Blank() && (('WorkersComp'[ClosedME] = Blank()) || WorkersComp[ClosedME] >PrevPMax))))

Y lo intenté

KeepFilters =

Var Segmentvar = AllSELECTED(WorkersComp[Segment])

var divisionvar = allSELECTED(WorkersComp[subsegmento])

Var PrevPMax = EOMONTH(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),-12)

Devolución

CALCULATE(Count(WorkersComp[Solvinjury ID]),WorkersComp[Segment] in Segmentvar,WorkersComp[Sub-Segment]in Divisionvar,

Keepfilters(WorkersComp),(WorkersComp[InclusiveStatus]="Yes" && WorkersComp[DateSubmittedME] <=PrevPMax && WorkersComp[DateSubmittedME] <> Blank() && (('WorkersComp'[ClosedME] = Blank()) || WorkersComp[ClosedME] >PrevPMax)))

Resultados:

Ryks_0-1642839380455.png

¿Alguna idea?

jbirco
Resolver I
Resolver I

puede probar 'lydate ? MAX(Date[Dates])-365' o puede probar la función DATEADD

Esto no es una sintaxis válida: parece que está mezclando inteligencia de tiempo incorporada con inteligencia de tiempo personalizada. Parece que tienes una tabla de calendario. La fecha de la tabla de calendario debe estar en el objeto visual. Entonces podrías escribir esto

calculate([measure],sameperiodlastyear(date[date]))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

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.