ldmass
3 years agoRegular Visitor
Get last sequences for a value in date range
Hi Experts, I'm having trouble solving an issue that seems simple but I can't find the solution. I have a table where I have the following columns: Sinister Sequence Date Patient Episode Ty...
- 3 years ago
HI ldmass ,
Adjust to the below:
TEST = var maxdate=CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALL ( 'Table' ), 'Table'[Sinister] = MAX ( 'Table'[Sinister] ) && 'Table'[Date] >= CALCULATE ( MIN ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) ) && 'Table'[Date] <= CALCULATE ( MAX ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) ) ) ) var pd1= IF ( CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALL ( 'Table' ), 'Table'[Sinister] = MAX ( 'Table'[Sinister] ) && 'Table'[Date] >= CALCULATE ( MIN ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) ) && 'Table'[Date] <= CALCULATE ( MAX ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) ) ) ) = MAX ( 'Table'[Date] ), 1, 0 ) var pd2=IF(MAX('Table'[Sequence])= CALCULATE ( MAX ( 'Table'[Sequence]), FILTER ( ALL ( 'Table' ), 'Table'[Sinister] = MAX ( 'Table'[Sinister] )&&'Table'[Date]= maxdate)),1,0) return IF(PD1=1&&pd2=1,1,0)Result:
Best Regards
Lucien