Page 1 of 1
Number of Business Day in a Year and in a Month? TM1 Fun
Posted: Thu Sep 04, 2014 5:02 pm
by dharav
Hello All
I would like to know what could be the best possible solution for below rules. I would like to know about TM1 function which would give me the number of business days in both months and a year.
Rules:
['Prior Year','Jan','BDays']=23;
['Prior Year','Feb','BDays']=20;
['Prior Year','Mar','BDays']=22;
['Prior Year','Apr','BDays']=21;
['Prior Year','May','BDays']=23;
['Current Year','Jan','BDays']=22;
['Current Year','Feb','BDays']=21;
['Current Year','Mar','BDays']=20;
['Current Year','Apr','BDays']=21;
['Current Year','May','BDays']=23;
Above rules, how could i feed? Moreover, i would like to know about the TM1 Function which could bring business days in each month and in a year.
Thank You
Dharav
Re: Number of Business Day in a Year and in a Month? TM1 Fun
Posted: Thu Sep 04, 2014 6:30 pm
by declanr
You can feed anything from anything so you can just put a 1 in a 2d cube somewhere and feed from that but since it's something that will never change it doesn't really make sense to have it as a rule anyway, just TI the numbers in.
On the question of calculating "business days" - if you mean monday to friday its simply a 5 over 7 times number of weeks. If you want to include bank holidays etc then every business and country will be different so you can't, however such things are often held in the company's data warehouse somewhere so you can grab it from there.
Re: Number of Business Day in a Year and in a Month? TM1 Fun
Posted: Thu Sep 04, 2014 7:44 pm
by lotsaram
My question would be why oh why oh why would you HARD CODE YTD business days into a rule.
This data should be entered into a lookup cube as data (just enter a 1 into the relevant date and make sure relevant date rollups are created) then this is much more flexible and much more maintainable.
Re: Number of Business Day in a Year and in a Month? TM1 Fun
Posted: Thu Sep 04, 2014 8:50 pm
by Wim Gielis
Indeed, why on earth would you do this using business rules? What's the dynamic part in this?
There is no such function to calculate this.
Your best bet is to set up an Excel file that contains these dates and use Turbo Integrator to load it as a CSV file.
Either with 1's on specific dates and rollups as Lotsaram suggests, either straight into a small 3D cube with months, years, measures.
No need to do complex dynamic calculations for something that is not dynamic.
Re: Number of Business Day in a Year and in a Month? TM1 Fun
Posted: Fri Sep 05, 2014 11:57 am
by dharav
Thank You Guys!
I already uploaded these numbers through TI.
Re: Number of Business Day in a Year and in a Month? TM1 Fun
Posted: Thu Nov 27, 2014 8:43 am
by tsw
I was actually thinking of a self-maintaining solution to do this a few months ago without having to keep a TI process to update a cube.
I think you could build a small 2 dimensional cube with numOfDays in 1 dimension and dayOfWeekStart (0-6) ... and populate the cube with appropriate 20 to 23 values.
You should be able to calculate the 2 lookup parameters: numOfDays and dayOfWeekStart from your month using various Date functions.
Then, I started thinking about how nice it would be to have User Defined TM1 Functions we could encapsulate code to use in rules...