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
IF
Post Prodigy
Post Prodigy

Valor de diciembre del año anterior

Hola

Quiero mostrar el valor de diciembre del año anterior. Seguí los pasos que se publican pero no pude obtener el resultado.

aquí está la medida:

MeasureValue1 á CALCULATE(SUM('Table'[value1]),FILTER('Table', 'Table'[Year]-SELECTEDVALUE('Table'[Year])-1&&'Table'[Month]-12))

Segunda medida:

MeasureValue1(b) ?
VAR _selectedyear-SELECTEDVALUE('Tabla'[Fecha])-1
return CALCULATE(SUM('Table'[value1]), FILTER(ALL('Table'), YEAR('Table'[Date])-_selectedyear&&MONTH('Table'[Date])-12))
ambos no me dan resultado.

NameMonth.YearDatevalue1value2

a12.20191.12.201912
b12.20191.12.201912
a01.201901.1.201945
b01.201901.1.201945
a12.20181.12.201878
b12.20181.12.201878
a02.20191.2.20191122
b02.20191.2.20191122
a12.20171.12.20171214
b12.20171.12.20171315
a03.20171.03.20171820
b03.20171.03.20171921
a12.20201.12.20203133
b12.20201.12.20203234
a04.20201.04.20203739
b04.20201.04.20203840
a12.20191.12.20194547
b12.20191.12.20194648

Si se selecciona cualquier mes en 2020 el resultado debe ser 93, para la selección de 2019, debe ser 14; y debería ser 25 para la selección de cualquier valor en 2018.

el archivo está disponible en: https://www.dropbox.com/s/g6cs2tsbk9x6s0k/December%20previous%20year%28share%29.pbix?dl=0

Gracias de antemano!

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@IF

se puede probar esto

Measure = 
VAR yr=right(SELECTEDVALUE('Table'[Month.Year]),4)-1
return SUMX(FILTER(all('Table'),'Table'[Month.Year]="12."&yr),'Table'[value1])

1.PNG

Por favor, compruebe amablemente el siguiente archivo pbix.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

@IF

se puede probar esto

Measure = 
VAR yr=right(SELECTEDVALUE('Table'[Month.Year]),4)-1
return SUMX(FILTER(all('Table'),'Table'[Month.Year]="12."&yr),'Table'[value1])

1.PNG

Por favor, compruebe amablemente el siguiente archivo pbix.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@IF, con ayuda de la tabla de fechas

el pasado diciembre de diciembre de

var _mon á month(today())

devolución

CALCULATE(SUM(Table[Value]),DATESMTD(dateadd('Date'[Date],-1*_mon ,MONTH)))

Para obtener lo mejor de la función de inteligencia del tiempo. Asegúrese de que tiene un calendario de fechas y que se ha marcado como la fecha en la vista de modelo. Además, únete a ella con la columna de fecha de tus hechos. Consulte :radacad sqlbi My Video Series Aprecia tus Felicitaciones.

¿Puede compartir datos de ejemplo y salida de ejemplo en formato de tabla? O una muestra de pbix después de eliminar datos confidenciales.

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.