Forum Discussion
OracleGuru
6 years agoFrequent Visitor
Calculated Column = Latest value for each visit id
In the example below, I want to create a calculated column that shows the insurance from the last "Trx Date" for the patient's visit id on all rows for that patient's visit id.
OracleGuru try follow measure
Last Insurance = VAR __lastVisitDate = CALCULATE ( MAX ( 'Table'[Trx Date] ), ALLEXCEPT ( 'Table', 'Table'[Visit Id] ) ) RETURN CALCULATE ( MAX ( 'Table'[Insurance] ), ALLEXCEPT ( 'Table', 'Table'[Visit Id] ), 'Table'[Trx Date] = __lastVisitDate )
2 Replies
- parry2kSuper User
OracleGuru try follow measure
Last Insurance = VAR __lastVisitDate = CALCULATE ( MAX ( 'Table'[Trx Date] ), ALLEXCEPT ( 'Table', 'Table'[Visit Id] ) ) RETURN CALCULATE ( MAX ( 'Table'[Insurance] ), ALLEXCEPT ( 'Table', 'Table'[Visit Id] ), 'Table'[Trx Date] = __lastVisitDate )- OracleGuruFrequent Visitor
Worked like a charm. Thank you very much.