Hello,
I seek for help because I don’t know if it is just impossible by MAQL or if I spent hours doing something wrong. Can you please help me ?
We have a dataset like the one below. The users are registered to a specific training course. Each registration have a starting date. The end can be null or set to a specific date.
Training Course | User | Registration Start (Shared Date) | Registration End |
---|---|---|---|
Onboarding | A | 2022-12-01 | 2023-12-31 |
Onboarding | B | 2023-07-01 | null |
Onboarding | C | 2024-01-01 | null |
Onboarding | D | 2023-12-01 | 2024-02-2024 |
Onboarding | E | 2022-12-01 | null |
I want to have a metric to calculate the number of open registrations. It must count a registration if his end date is null or above the minimum date in the filter, and the start date must be lower than the maximum date in the filter. It can give something like this : (Date(Registration End) >= Start_Date OR Date(Registration End) = (empty value)) AND Date(Registration Start) <= End_Date
For example, if I select in the date filter «Last Year», the result should be 4 : users A, B, D, E
- User A : his start date is before 2023-01-01 and his end date is included in 2023
- User B : his start date is included in 2023 and has no end date
- User D : his start date is included in 2023 and his end date is above 2023-12-31
- User E : his start date is before 2023-01-01 and has no end date
- User C is not count because his start date is after 2023-12-31
For example, if I select in the date filter «This Year», the result should also be 4 but with users B, C, D, E
- User A is not count because his end date is before 2024-01-01
Thank you very much for your help
Renaud