Forum Discussion
DAX Lookup within Date Range
- Anonymous2 years ago
Actually i resolved it myself taking a direction from your query - thanks so much was very helpful.
for anyone interested, this was the solution that worked perfectly.
i jsut needed to add an additional ID column as well to the tables, but you can just remove those bits from this query below and use it.ReserveHistValue =CALCULATE(LASTNONBLANK('Reserve History'[Section5 Removed], 1),FILTER('Reserve History','Reserve History'[FactCaseReserveHistory[Caseref]]] = EARLIER('UNION'[CLAIM_REFERENCE_SUPPLIER]) &&'Reserve History'[FactCaseReserveHistory[AuditTimeStamp]]]=MAXX(FILTER('Reserve History','Reserve History'[FactCaseReserveHistory[Caseref]]] = EARLIER('UNION'[CLAIM_REFERENCE_SUPPLIER]) &&'Reserve History'[FactCaseReserveHistory[AuditTimeStamp]]] <= EARLIER('UNION'[BOOKING_DATE_SUPPLIER])),'Reserve History'[FactCaseReserveHistory[AuditTimeStamp]]])))
Anonymous ,Try using below method
ReserveHistValue =
VAR SelectedDate = SELECTEDVALUE('DateTable'[Date])
RETURN
CALCULATE(
LASTNONBLANK('Table1'[ReserveHist], 1),
FILTER(
ALL('Table1'),
'Table1'[DateHist] <= SelectedDate
)
)
- Anonymous2 years agoNot applicable
thanks for your reply, but this didnt work sadly 😞 any suggestions why?
- Anonymous2 years agoNot applicable
Actually i resolved it myself taking a direction from your query - thanks so much was very helpful.
for anyone interested, this was the solution that worked perfectly.
i jsut needed to add an additional ID column as well to the tables, but you can just remove those bits from this query below and use it.ReserveHistValue =CALCULATE(LASTNONBLANK('Reserve History'[Section5 Removed], 1),FILTER('Reserve History','Reserve History'[FactCaseReserveHistory[Caseref]]] = EARLIER('UNION'[CLAIM_REFERENCE_SUPPLIER]) &&'Reserve History'[FactCaseReserveHistory[AuditTimeStamp]]]=MAXX(FILTER('Reserve History','Reserve History'[FactCaseReserveHistory[Caseref]]] = EARLIER('UNION'[CLAIM_REFERENCE_SUPPLIER]) &&'Reserve History'[FactCaseReserveHistory[AuditTimeStamp]]] <= EARLIER('UNION'[BOOKING_DATE_SUPPLIER])),'Reserve History'[FactCaseReserveHistory[AuditTimeStamp]]])))