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

Cálculo del valor anterior más reciente a partir de otra columna

Hola a todos - Estoy buscando orientación o ejemplos sobre un cálculo.

Para simplificar mi escenario, digamos que tengo un edificio. Este edificio puede contener un cierto número de elementos (un límite). Ese límite puede cambiar con el tiempo, y el valor se proporciona de forma irregular. También tengo observaciones diarias sobre cuántos artículos hay realmente en ese edificio. Para cada una de esas observaciones, también quiero mostrar el límite reportado más recientemente.
SitioFechaValor realValor real más reciente
Sitio A1-Jun1010
Sitio A2-Jun 10
Sitio A3-Jun 10
Sitio A4-Jun 10
Sitio A5-Jun 10
Sitio A6-Jun200200
Sitio A7-Jun 200
Sitio A8-Jun 200
Sitio A9-Jun 200
Sitio A10-Jun 200
Sitio B1-Jun3030
Sitio B2-Jun 30
Sitio B3-Jun 30
Sitio B4-Jun100100
Sitio B5-Jun 100
No puedo entender esto en DAX... Creo que esto debe ser una nueva columna calculada en lugar de una medida para calcular un valor para cada fecha y sitio. LASTDATE no funciona porque solo examina el valor más reciente en lugar del más reciente en relación con cada fecha.
¿Alguna sugerencia o ejemplo? ¡Gracias por las ideas!
2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hola @luke_f ,

Puede crear una medida como se indica a continuación:

Measure = 
var _curdate=MAX('Table'[Date])
var _predate=CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Date]<_curdate&&NOT(ISBLANK('Table'[Actual Value]))))
var _prenum=CALCULATE(MAX('Table'[Actual Value]),FILTER(ALL('Table'),'Table'[Date]=_predate&&'Table'[Site]=MAX('Table'[Site])))
return if(ISBLANK(MAX('Table'[Actual Value])),_prenum,MAX('Table'[Actual Value]))

create measure.JPG

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jdbuchanan71
Super User
Super User

@luke_f

Pruébalo.

Column = 
VAR _RowDate = 'Table'[Date]
RETURN
CALCULATE(LASTNONBLANK('Table'[Actual Value],TRUE()),ALLEXCEPT('Table','Table'[Site]),'Table'[Date] <= _RowDate)

jdbuchanan71_0-1594326799105.png

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.