What I’m trying to do is to distil multiple involvement values into the most significant value based on the following criteria in order of preference:
A team that is open on a specific date - the involvement may be subsequently ended. If there is more than 1, take the involvement with the most recent start date.
For anyone that doesn’t have an open team on the specific date (1), take a team ended during the reporting period. If there is more than 1, take the team with the most recent end date, and then the team with the most recent start date.
For anyone not in (1) or (2), the logic of (1) but using the team of the person open on a specific date.
For anyone not in (1), (2) or (3), the logic of (2) but using the team of the person.
Initially, I did this as a single query returning all people and teams open during the reporting period, but that was over 50% #MULTIVALUE errors which I couldn’t clear. I then split it into 4 queries based on the 4 conditions, and got it down to 10% #MULTIVALUE errors. Again, I haven’t been able to clear them. It also adds significantly to the query time.
Ideally, I’d like to handle this as a single query avoiding duplicate rows wherever possible, but short of doing it as an insanely complex UNION query (I really wish there was a way to simplify UNIONs using the in list/not in list logic instead of using sub-queries), I don’t see a way round it. I could add involvements to the main query, but we run into the issue of users with no involvements during the date period and some of our records stretch back years.
We’re using BI 4.1, sp5 and I don’t have access to the universe. If anyone has any ideas, please help! I suspect it’s a matter of using FOREACH (or FORALL) and adding start and end dates into the formulas but I’ve tried that and it doesn’t seem to work very well.