Multiple TM1 Formulae in a single cell
-
- Posts: 4
- Joined: Thu Nov 14, 2013 6:15 am
- OLAP Product: Tm1
- Version: 10.1
- Excel Version: 2007
Multiple TM1 Formulae in a single cell
Is there a limitation to the number of DBRW formulae that can be used in a single cell? (eg IF THEN ELSE)
-
- MVP
- Posts: 733
- Joined: Wed May 14, 2008 11:06 pm
Re: Multiple TM1 Formulae in a single cell
The official limit is 64 levels of nesting. This level of IF nesting would be truly ridiculous - you should be aiming to write one DBR(W) per cell and to minimise use of any other logic in the formula itself and implement the logic in the cube rules themselves.
Robin Mackenzie
-
- 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: Multiple TM1 Formulae in a single cell
From memory the limit of nested IF statements in Excel is 14; you can of course extend this a bit by getting creative.
On another note it's 20 nested IF statements in TI on last count.
And I haven't looked in a while so Microsoft or IBM may have extended their limits in more recent versions, doubt it though.
On another note it's 20 nested IF statements in TI on last count.
And I haven't looked in a while so Microsoft or IBM may have extended their limits in more recent versions, doubt it though.
Declan Rodger
-
- 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: Multiple TM1 Formulae in a single cell
I stand corrected... I was thinking nested IFs rather than IFs and Elses but I can't remember where I had 14 from...
Declan Rodger
-
- Posts: 4
- Joined: Thu Nov 14, 2013 6:15 am
- OLAP Product: Tm1
- Version: 10.1
- Excel Version: 2007
Re: Multiple TM1 Formulae in a single cell
Thanks Guys!rmackenzie wrote:The official limit is 64 levels of nesting. This level of IF nesting would be truly ridiculous - you should be aiming to write one DBR(W) per cell and to minimise use of any other logic in the formula itself and implement the logic in the cube rules themselves.
Robin, is there a reason why I should be aiming for one DBR per cell?
-
- MVP
- Posts: 733
- Joined: Wed May 14, 2008 11:06 pm
Re: Multiple TM1 Formulae in a single cell
It's a matter of maintaining reports in a way that they're auditable and transparent, I guess. There's no reason that simple arithmetic can't be programmed into TM1 rules and dimension structures - meaning that the logic (and implied business rule) is captured and maintained in the TM1 server rather than in Excel spreadsheets which rapidly become a nightmare to version control and manage etc. Traditionally, a big part of the TM1 sell depends on preventing 'Excel hell' and using one DBR(W) per cell is the cornerstone of this.
If you find yourself writing IF statements or other formulas using different DBR(W)s then have a look at adding extra elements/ consolidations to your dimensions to see if you can split out the logic in the rules. E.g. could be replaced by if elem4 is a consolidation of elem2 and elem3.
Make sense?
<edit>A better example with cube rules would be if you need to do a multiplication in the Excel formula. E.g.: could be replaced by if a rule existed in the cube like this:
</edit>
If you find yourself writing IF statements or other formulas using different DBR(W)s then have a look at adding extra elements/ consolidations to your dimensions to see if you can split out the logic in the rules. E.g.
Code: Select all
=DBRW(server:cube,elem1,elem2)+DBRW(server:cube,elem1,elem3)
Code: Select all
=DBRW(server:cube,elem1,elem4)
Make sense?
<edit>A better example with cube rules would be if you need to do a multiplication in the Excel formula. E.g.:
Code: Select all
=DBRW(server:cube,elem1,elem2) * DBRW(server:cube,elem1,elem3)
Code: Select all
=DBRW(server:cube,elem1,elem4)
Code: Select all
['elem4'] = N: ['elem2'] * ['elem3'];
Robin Mackenzie
-
- Site Admin
- Posts: 6667
- Joined: Sun May 11, 2008 2:30 am
- OLAP Product: TM1
- Version: PA2.0.9.18 Classic NO PAW!
- Excel Version: 2013 and Office 365
- Location: Sydney, Australia
- Contact:
Re: Multiple TM1 Formulae in a single cell
Another reason for using Robin's second method is that the DBRW formulas (as opposed to DBRs) transmit and receive data to and from the server in batches, whereas DBRs do it one value at a time, making them much slower than DBRWs. My understanding is that when you put 2 or more DBRWs in the one cell, though, they revert to DBR behaviour. If I can find the reference to that I'll add it here but don't have it to hand at the moment.rmackenzie wrote:It's a matter of maintaining reports in a way that they're auditable and transparent, I guess. There's no reason that simple arithmetic can't be programmed into TM1 rules and dimension structures - meaning that the logic (and implied business rule) is captured and maintained in the TM1 server rather than in Excel spreadsheets which rapidly become a nightmare to version control and manage etc. Traditionally, a big part of the TM1 sell depends on preventing 'Excel hell' and using one DBR(W) per cell is the cornerstone of this.
If you find yourself writing IF statements or other formulas using different DBR(W)s then have a look at adding extra elements/ consolidations to your dimensions to see if you can split out the logic in the rules. E.g.could be replaced byCode: Select all
=DBRW(server:cube,elem1,elem2)+DBRW(server:cube,elem1,elem3)
if elem4 is a consolidation of elem2 and elem3.Code: Select all
=DBRW(server:cube,elem1,elem4)
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-
- Posts: 4
- Joined: Thu Nov 14, 2013 6:15 am
- OLAP Product: Tm1
- Version: 10.1
- Excel Version: 2007
Re: Multiple TM1 Formulae in a single cell
I thought there might be an impact to workbook performance or getting incorrect values. As a matter of principle I totally agree that all logic should reside in TM1, but implementing this into production is quite expensive and more often than not users might not even need or use this new rule or calculation. I normally protype in Excel and after a period would migrate to TM1 rules or TI.
Thanks Robin & Alan!
Thanks Robin & Alan!