I am trying to create a dataset for a range chart in SSRS, the purpose of this chart is to act as a promotional calendar for our sales team to be able to see where they have promotions and at times multiple concurrent promotions running at retail. I have got the bar chart working well but I am struggling with overlapping dates.
I have a test dataset that highlights my problem
[CREATE TABLE #promotiontest
(
Brand VARCHAR(20),
Product VARCHAR(20),
Deals VARCHAR(20),
StartDate DATE,
EndDate DATE,
Duration INT,
LineID INT
)
insert into #promotiontest values('Brand A','Product A','Deal 1','2016-06-01','2016-06-30','29',1);
insert into #promotiontest values('Brand A','Product A','Deal 2','2016-06-10','2016-09-30','112',2);
insert into #promotiontest values('Brand A','Product A','Deal 3','2016-06-25','2016-07-31','36',3);
insert into #promotiontest values('Brand A','Product A','Deal 4','2016-06-25','2016-07-31','36',4);
insert into #promotiontest values('Brand A','Product A','Deal 5','2016-06-30','2016-07-14','14',1);
insert into #promotiontest values('Brand A','Product A','Deal 6','2016-08-31','2016-09-30','30',1);
insert into #promotiontest values('Brand A','Product B','Deal 7','2016-06-01','2016-06-30','29',1);
insert into #promotiontest values('Brand A','Product B','Deal 8','2016-07-01','2016-07-30','29',1);
insert into #promotiontest values('Brand A','Product B','Deal 9','2016-07-31','2016-08-31','31',1);
insert into #promotiontest values('Brand A','Product B','Deal 10','2016-09-01','2016-09-30','29',1);
SELECT *
FROM #promotiontest
My challenge, is I need to create a dynamic column that works just like LineID (which I have hardcoded to show how it should look). LineID is used to signify if there are overlapping promotions, 1 means it is the first one, 2 means its the second etc etc. The challenge is getting Deal 5 to have a lineID of 1, as the promotion that is on Line 1 would have finished. All of product B should be on one line as there are no overlaps. This needs to be dynamic because if deal 2 was filtered out by the user I need that line to disappear in the report.
I use the LineID in the range chart to work as a grouping, which I have uploaded below.
Apologies if this doesn't make sense.
Any help would be gratefully received.
Thank you