I would like to get the last Facility value from the dataset meeting this filter criteria. I am trying to use LASTNONBLANK() as follows and getting syntax error "Multiple columns cannot be converted to a Scalar Value”. I believe I need to covert the second parameter, a FILTER returning a set of rows, to a column, but I specify the column in the first parameter. Any clues on the right syntax?
=if(([Readmit Denominator Account]=""||[VISIT_TYPE]<>"INPATIENT"),"",
LASTNONBLANK('Charges'[Facility],
FILTER(Charges,(
'Charges'[YH_MRN] = EARLIER('Charges'[YH_MRN]) &&
'Charges'[Facility] <> EARLIER('Charges'[Facility]) &&
'Charges'[Discharge Date] < (EARLIER('Charges'[AdmitDate])) &&
'Charges'[Discharge Date] >= (EARLIER('Charges'[AdmitDate])-30) &&
Charges[VISIT_TYPE] =(EARLIER(Charges[VISIT_TYPE]))
))
))
=if(([Readmit Denominator Account]=""||[VISIT_TYPE]<>"INPATIENT"),"",
LASTNONBLANK('Charges'[Facility],
FILTER(Charges,(
'Charges'[YH_MRN] = EARLIER('Charges'[YH_MRN]) &&
'Charges'[Facility] <> EARLIER('Charges'[Facility]) &&
'Charges'[Discharge Date] < (EARLIER('Charges'[AdmitDate])) &&
'Charges'[Discharge Date] >= (EARLIER('Charges'[AdmitDate])-30) &&
Charges[VISIT_TYPE] =(EARLIER(Charges[VISIT_TYPE]))
))
))