Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How did you create your Master Calendar? Did you take the min/max of the dates and build an entry for every date?
Hello,
This is my master Calendar
QuartersMap:
MAPPING LOAD
rowno() as Month,
'Q' & Ceil (rowno()/3) as Quarter
AUTOGENERATE (12);
Temp:
Load
min(DELIVERY_DATE) as minDate,
max(DELIVERY_DATE) as maxDate
Resident FACT;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
TempCalendar:
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) As TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
MasterCalendar:
Right Join(FACT)
Load
TempDate AS DELIVERY_DATE,
week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month,
Day(TempDate) As Day,
date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,
ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,
WeekDay(TempDate) as WeekDay
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;
Hi,
there is probably a better way. But a quick fix would be to add a 0 to every day on your master calendar.
So this is my measure where days without data are missing: Sum(Sales)
This is my new measure: Sum(Sales) + (Count([Datefield]) * 0)
You could also add the value 0 to the master calendar.
Load
0 as 0.Calandar,
TempDate AS DELIVERY_DATE,
week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month,
Day(TempDate) As Day,
date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,
ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,
WeekDay(TempDate) as WeekDay
Resident TempCalendar
And change your measures to Sum(Sales) + sum(Calendar.0)
Hello,
Thank you for your reply...
(Sum(LPD))/$(MaxDeliveryDay).........This is what i am calculating.....When i select 1-15 Day $(MaxDeliveryDay) gives me 13 because on 2 days there wasn't any activity but i want 15 there.......How's that possible??
Regards
Hello,
This is my master Calendar
QuartersMap:
MAPPING LOAD
rowno() as Month,
'Q' & Ceil (rowno()/3) as Quarter
AUTOGENERATE (12);
Temp:
Load
min(DELIVERY_DATE) as minDate,
max(DELIVERY_DATE) as maxDate
Resident FACT;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
TempCalendar:
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) As TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
MasterCalendar:
Right Join(FACT)
Load
TempDate AS DELIVERY_DATE,
week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month,
Day(TempDate) As Day,
date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,
ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,
WeekDay(TempDate) as WeekDay
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;
(Sum(LPD))/$(MaxDeliveryDay).........This is what i am calculating.....When i select 1-15 Day $(MaxDeliveryDay) gives me 13 because on 2 days there wasn't any activity but i want 15 there.......How's that possible??
Regards