Forum Discussion
Using Multiple VARs as a Filter Context with an OR Condition
- 2 years ago
Anonymous thanks for pointing me in the right direction regarding Union and Treatas. After some playing around I got the following code to work as needed:
Count of Enrollments Closed With a Successful Outcome =VAR _FinancialOutcomes = SUMMARIZE(CALCULATETABLE('Financial Outcomes','new_clientsurveys'[new_outcomesum_ac_financial_base] >= 1,NOT ISBLANK ( 'Financial Outcomes'[new_projectenrolmentlookup] ),REMOVEFILTERS ('Calendar')),[new_projectenrolmentlookup])VAR _SuccessfullNonFinancialOutcome = SUMMARIZE(CALCULATETABLE('Non-Financial Outcomes','Non-Financial Outcomes'[new_outcomesubtype_ac] <> "Case concluded unsuccessfully",'Non-Financial Outcomes'[new_outcomesubtype_ac] <> "Client ceased to give instructions",'Non-Financial Outcomes'[new_outcomesubtype_ac] <> "Unknown Outcome",NOT ISBLANK ( 'Non-Financial Outcomes'[new_projectenrolmentlookup] ),REMOVEFILTERS ('Calendar')),[new_projectenrolmentlookup])VAR _CombinedOutcomes =UNION(_FinancialOutcomes,_SuccessfullNonFinancialOutcome)RETURNCALCULATE ([Count of Enrollments Closed],TREATAS (_CombinedOutcomes, 'Enrollment ID by AC Project'[pre_projectenrolmentid]),USERELATIONSHIP ( 'Enrollment ID by AC Project'[pre_enddate], 'Calendar'[Date] ))
Hi Anonymous,
Thanks for this, really helpful. I should have thought about UNION.
I tried the DAX use suggested but it come up with an error as follows:
It might be worth saying that the datatype of [new_projectenrolmentlookup] is Text, so the error might be because of the use of VALUES?
I also tried using the previous RETURN code I was using as follows which passes the syntax check, but doesn't seem to be worked as every enrollment comes up as closed successfully - which isn't correct - although I need to check the data to completely rule this out.
Appreciate any further thoughts.
Thanks,
Adam
Anonymous thanks for pointing me in the right direction regarding Union and Treatas. After some playing around I got the following code to work as needed:
- Anonymous2 years agoNot applicable