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

Medir con el año anterior

Tengo dos medidas que están funcionando muy bien como se define a continuación. También estoy tratando de crear una nueva medida que devuelva los activos del año anterior. La tabla de hechos y la tabla de calendario no están unidas ya que la tabla de hechos tiene dos campos de intervalo de fechas, DateBeg y DateEnd.

Activo = SUMX(EmployeeAsOf,EmployeeAsOf[ActiveRecord])

ActiveAsOfPY =
VAR CurrDate = SELECTEDVALUE('Calendar'[CalDate])
Resultados VAR = CALCULAR(
[Activo],
CurrDate >= EmployeeAsOf[DateBeg],
CurrDate <= EmployeeAsOf[DateEnd])
DEVOLUCIÓN
RESULTADOS

Se intentó utilizar la función DateAdd para crear una nueva medida, pero no es válida.

VAR PYCurrDate = DATEADD(SELECTEDVALUE('Calendar'[CalDate]), -1, AÑO)

¡Agradezco cualquier ayuda sobre cómo puedo lograr esto y gracias!

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

@JAKEDBG , Prueba como

ActiveAsOfPY =
VAR CurrDate1 = SELECTEDVALUE('Calendar'[CalDate])
VAR CurrDate = fecha(año(CurrDate1)-1, mes(CurrDate1), día(CurrDate1))
Resultados VAR = CALCULAR(
[Activo],
CurrDate >= EmployeeAsOf[DateBeg],
CurrDate <= EmployeeAsOf[DateEnd])
DEVOLUCIÓN
RESULTADOS

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

@JAKEDBG , Prueba como

ActiveAsOfPY =
VAR CurrDate1 = SELECTEDVALUE('Calendar'[CalDate])
VAR CurrDate = fecha(año(CurrDate1)-1, mes(CurrDate1), día(CurrDate1))
Resultados VAR = CALCULAR(
[Activo],
CurrDate >= EmployeeAsOf[DateBeg],
CurrDate <= EmployeeAsOf[DateEnd])
DEVOLUCIÓN
RESULTADOS

¡Gracias por su ayuda! Esa fue una solución rápida y funcionó exactamente como tenía que ser.

¡Se lo agradezco!

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.