Hi,
I need some day treatment based on working centers and their calendars. So I use the Networkdays and try to send parameters via an Applymap(), as in the example code it follows:
Holidays:
Load * inline [
Center,Holidays
A,28/02/2017
A,01/03/2017
];
MapCenterHolidays:
Mapping
Load Center,
Concat(chr(39) & Holidays & chr(39),',')
Resident Holidays
group by Center;
Facts:
Load Start_Date,
End_Date,
ApplyMap('MapCenterHolidays',Center,Null()) as Holidays,
NetWorkDays(Start_Date,End_Date) as DaysSpent,
NetWorkDays(Start_Date,End_Date,ApplyMap('MapCenterHolidays',Center,Null())) as DaysSpentHolidays;
Load 'A' as Center,
Date(MakeDate(2017,2,27)) as Start_Date,
Date(MakeDate(2017,3,3)) as End_Date
AutoGenerate(1);
drop table Holidays;
So for Center=A I have two holiday dates between Start_Date and End_Date. I create two fields, DaysSpent and DaysSpentHolidays, to compare both of them, but they are returning the same value both. I figured out it is because the parameter for holidays is not properly passed to the function.
I read about using variables for this purpose, but the working center amount and record number of this table doesn't advise doing any loop.
In the document, I can display this different measures:
Only last one is correct and you can see the formulas written to get each result.
So, my question is, is there any way to get this ApplyMap() send the correct parameters to the Networkdays() function? Is it a formatting issue or am I doing a wrong use of this function combination?
Thanks!!!
Miguel