Number of Business Day in a Year and in a Month? TM1 Fun

Post Reply
dharav
Regular Participant
Posts: 193
Joined: Wed Apr 02, 2014 6:43 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2010

Number of Business Day in a Year and in a Month? TM1 Fun

Post 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
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: Number of Business Day in a Year and in a Month? TM1 Fun

Post 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.
Declan Rodger
lotsaram
MVP
Posts: 3706
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Number of Business Day in a Year and in a Month? TM1 Fun

Post 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.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Wim Gielis
MVP
Posts: 3240
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Number of Business Day in a Year and in a Month? TM1 Fun

Post 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.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
dharav
Regular Participant
Posts: 193
Joined: Wed Apr 02, 2014 6:43 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2010

Re: Number of Business Day in a Year and in a Month? TM1 Fun

Post by dharav »

Thank You Guys!

I already uploaded these numbers through TI.
tsw
Posts: 47
Joined: Tue Nov 12, 2013 12:14 am
OLAP Product: TM1, PowerPlay, Transformer
Version: PA 2.0.4
Excel Version: Office 365

Re: Number of Business Day in a Year and in a Month? TM1 Fun

Post 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...
Post Reply