Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi i wonder if anyone can help me find a solution for a tricky problem.
i have a fact table that Holds a %Calendar_Key and a %Cycle_Plan_Key and a %Consent_Key
the problem is the %Calendar_Key is a range calender key that holds start date and an end date.
This is to determine when a Consent started and when it will expire.
eg %Consent_Key = 123456 has a calender key of 43131|44159 this equates to the below
31/01/2019
until
31/10/2020
this will join to a master calender that holds all the individual months and years for this range.
on the other side i have also a list of %Cycle_Plan_Key in the fact table this will determine which monthly cycles fall withing the start date and end date range,
example.
%Cycle_Plan_Key
a4g1o000000TVeHAAW
Cycle name is
2019.1.1-2019.4.30
the problem is when i select this Cycle Name 2019.1.1-2019.4.30 i get all the month from jan until december , instead of just the months that fall into this Cycle. whcih should be Jan to April.
in the Cycle Dimension i do have a start date and end date that i can use to limit the dimension in the calender but im unsure how.
Cycle End Date Cycle Start Date
30/04/2019 01/01/2019
Fact
%Cycle_Plan_Key | %Account_Key | %Calendar_Key | CalenderKeyStart | CalenderKeyEnd | Year Month | %Consent_Key | Cycle Name | Month |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 31/01/2018 | 24/11/2020 | 01/10/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 10 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 01/02/2018 | 24/11/2020 | 01/09/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 9 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 02/02/2018 | 24/11/2020 | 01/08/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 8 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 03/02/2018 | 24/11/2020 | 01/07/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 7 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 04/02/2018 | 24/11/2020 | 01/06/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 6 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 05/02/2018 | 24/11/2020 | 01/05/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 5 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 06/02/2018 | 24/11/2020 | 01/04/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 4 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 07/02/2018 | 24/11/2020 | 01/03/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 3 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 08/02/2018 | 24/11/2020 | 01/02/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 2 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 09/02/2018 | 24/11/2020 | 01/01/2020 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 1 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 10/02/2018 | 24/11/2020 | 01/12/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 12 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 11/02/2018 | 24/11/2020 | 01/11/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 11 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 12/02/2018 | 24/11/2020 | 01/10/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 10 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 13/02/2018 | 24/11/2020 | 01/09/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 9 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 14/02/2018 | 24/11/2020 | 01/08/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 8 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 15/02/2018 | 24/11/2020 | 01/07/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 7 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 16/02/2018 | 24/11/2020 | 01/06/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 6 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 17/02/2018 | 24/11/2020 | 01/05/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 5 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 18/02/2018 | 24/11/2020 | 01/04/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 4 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 19/02/2018 | 24/11/2020 | 01/03/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 3 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 20/02/2018 | 24/11/2020 | 01/02/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 2 |
a4g1o000000TVeHAAW | 001U000000mH6WhIAK | 43131|44159 | 21/02/2018 | 24/11/2020 | 01/01/2019 | a3R1o000000cFC2EAM | 2019.1.1-2019.4.30-ES-R1 | 1 |
Cycle Dimension
Cycle Id | %Cycle_Plan_Key | Cycle End Date | Cycle Start Date | Cycle Plan Id | Cycle Plan Name | Cycle | Cycle Name |
a4i1o000000UnIKAA0 | a4g1o000000TVeHAAW | 30/04/2019 | 01/01/2019 | a4g1o000000TVeHAAW | 2019.1.1-2019.4.30-ES-ES_3604_CAS | Spain 01/01/2019 - 30/04/2019 | 2019.1.1-2019.4.30-ES-R1 |
Master Calender
%Calendar_Key | Date | Date Num | Month | Quarter | CycleNo | Year | Year Month | Year Month Num | Timeframe Displayed | Year Cycle |
43131|44159 | 31/01/2019 | 31/01/2019 | 1 | 1 | 1 | 2019 | 01/01/2019 | 01/01/2019 | Monthly | C1-2019 |
43131|44159 | 28/02/2019 | 28/02/2019 | 2 | 1 | 1 | 2019 | 01/02/2019 | 01/02/2019 | Monthly | C1-2019 |
43131|44159 | 31/03/2019 | 31/03/2019 | 3 | 1 | 1 | 2019 | 01/03/2019 | 01/03/2019 | Monthly | C1-2019 |
43131|44159 | 30/04/2019 | 30/04/2019 | 4 | 2 | 1 | 2019 | 01/04/2019 | 01/04/2019 | Monthly | C1-2019 |
43131|44159 | 31/05/2019 | 31/05/2019 | 5 | 2 | 2 | 2019 | 01/05/2019 | 01/05/2019 | Monthly | C2-2019 |
43131|44159 | 30/06/2019 | 30/06/2019 | 6 | 2 | 2 | 2019 | 01/06/2019 | 01/06/2019 | Monthly | C2-2019 |
43131|44159 | 31/07/2019 | 31/07/2019 | 7 | 3 | 2 | 2019 | 01/07/2019 | 01/07/2019 | Monthly | C2-2019 |
43131|44159 | 31/08/2019 | 31/08/2019 | 8 | 3 | 2 | 2019 | 01/08/2019 | 01/08/2019 | Monthly | C2-2019 |
43131|44159 | 30/09/2019 | 30/09/2019 | 9 | 3 | 3 | 2019 | 01/09/2019 | 01/09/2019 | Monthly | C3-2019 |
43131|44159 | 31/10/2019 | 31/10/2019 | 10 | 4 | 3 | 2019 | 01/10/2019 | 01/10/2019 | Monthly | C3-2019 |
43131|44159 | 30/11/2019 | 30/11/2019 | 11 | 4 | 3 | 2019 | 01/11/2019 | 01/11/2019 | Monthly | C3-2019 |
43131|44159 | 31/12/2019 | 31/12/2019 | 12 | 4 | 3 | 2019 | 01/12/2019 | 01/12/2019 | Monthly | C3-2019 |
43131|44159 | 31/01/2020 | 31/01/2020 | 1 | 1 | 1 | 2020 | 01/01/2020 | 01/01/2020 | Monthly | C1-2020 |
43131|44159 | 29/02/2020 | 29/02/2020 | 2 | 1 | 1 | 2020 | 01/02/2020 | 01/02/2020 | Monthly | C1-2020 |
43131|44159 | 31/03/2020 | 31/03/2020 | 3 | 1 | 1 | 2020 | 01/03/2020 | 01/03/2020 | Monthly | C1-2020 |
43131|44159 | 30/04/2020 | 30/04/2020 | 4 | 2 | 1 | 2020 | 01/04/2020 | 01/04/2020 | Monthly | C1-2020 |
43131|44159 | 31/05/2020 | 31/05/2020 | 5 | 2 | 2 | 2020 | 01/05/2020 | 01/05/2020 | Monthly | C2-2020 |
43131|44159 | 30/06/2020 | 30/06/2020 | 6 | 2 | 2 | 2020 | 01/06/2020 | 01/06/2020 | Monthly | C2-2020 |
43131|44159 | 31/07/2020 | 31/07/2020 | 7 | 3 | 2 | 2020 | 01/07/2020 | 01/07/2020 | Monthly | C2-2020 |
43131|44159 | 31/08/2020 | 31/08/2020 | 8 | 3 | 2 | 2020 | 01/08/2020 | 01/08/2020 | Monthly | C2-2020 |
43131|44159 | 30/09/2020 | 30/09/2020 | 9 | 3 | 3 | 2020 | 01/09/2020 | 01/09/2020 | Monthly | C3-2020 |
43131|44159 | 31/10/2020 | 31/10/2020 | 10 | 4 | 3 | 2020 | 01/10/2020 | 01/10/2020 | Monthly | C3-2020 |
At the moment this is what im getting
I managed to fix this
with the following formula in the month dimension and i get the dimension month correctly
if(Month([Cycle Start Date]) = 'May' and
Match (Month, 'May','Jun','Jul', 'Aug'), Month,
if(Month([Cycle Start Date]) = 'Jan' and
Match (Month, 'Jan','Feb','Mar', 'Apr'), Month,
if(Month([Cycle Start Date]) = 'Sep' and
Match (Month, 'Sep','Oct','Nov', 'Dec'), Month
)
)
)
what i want
what i have
I managed to fix this
with the following formula in the month dimension and i get the dimension month correctly
if(Month([Cycle Start Date]) = 'May' and
Match (Month, 'May','Jun','Jul', 'Aug'), Month,
if(Month([Cycle Start Date]) = 'Jan' and
Match (Month, 'Jan','Feb','Mar', 'Apr'), Month,
if(Month([Cycle Start Date]) = 'Sep' and
Match (Month, 'Sep','Oct','Nov', 'Dec'), Month
)
)
)