Hello,
I just started PowerBI for a few days,
currently I have some problem merging 2 tables in terms of date,
the data sample looks like below:
(1)Table A: Order fact which contains [OrderDate],[OrderNo]and other details
OrderDate OrderNo Qty ItemID ...
2016/03/03 001 1 123
2016/05/01 002 3 456
(2)Table B: A table of Sales campaign data which contains [Camp_ID][StartDate],[EndDate],[ItemID] and others
Camp_ID StartDate EndDate ItemID ...
CP001 2016/03/01 2016/04/01 123 ...
CP002 2016/03/15 2016/06/01 456 ...
What I'm trying to do is to create a relationship between these 2 tables that I can use [Camp_ID] as a filter for analysis.
I tried to create a unique key in each table to link them but it looks very unrealistic and non-expandable;
(e.x. CAMP_key = IF(DATEVALUE("06/01/2014")<=[OrderDate]&&[OrderDate]<DATEVALUE("07/31/2014") ,"CAMP1",
IF(DATEVALUE("08/01/2014")<=[OrderDate]&&[OrderDate]<DATEVALUE("08/31/2014") ,"CAMP2",
IF(DATEVALUE("10/01/2014")<=[OrderDate]&&[OrderDate]<DATEVALUE("10/31/2014")&&[ItemCD]="8287512" ,"CAMP3",
...........
Please let me know if you need any info as I think I didn't explain it very clearly.
ANY ideas and advice to help with this problem will be Greatly appeciated. Thank you very much!