YTD difference - rule or TI?

Post Reply
wigglyrat
Posts: 67
Joined: Wed Sep 02, 2015 3:09 pm
OLAP Product: TM1
Version: 10_2_2
Excel Version: 2010

YTD difference - rule or TI?

Post by wigglyrat »

Hi - I am looking to create a measure, 'YTD Difference.' This involves two dimensions 'Year' and 'Month' so in order to find the current date (which will be current month) both will need to be used.

Is this possible to do this in a rule and if so how would you go about this?

Code: Select all

['YTD Difference']=['1','2016','Renewal','Written Commission %']-['1','2015','Renewal','Written Commission %'];
In this example, I have hard coded current year as '2016' and the current month as '1' but this is clearly poor practice.

If anyone can please provide an example of how to do this - instead of '2016,' get current year, instead of '1,' get current month, (and another question: would 2015 be 2015 minus 1, and if so what would that mean for 'January' 2014 (could you subtract 1 from this to get the value you want?) it would be greatly appreciated.

Many thanks in advance,
User avatar
jim wood
Site Admin
Posts: 3961
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: YTD difference - rule or TI?

Post by jim wood »

You create a previous attribute for each year. You can then change the rule to a full DB rule and reference the previous year in the second part of the equation.
Struggling through the quagmire of life to reach the other side of who knows where.
Go Build a PC
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
lotsaram
MVP
Posts: 3704
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: YTD difference - rule or TI?

Post by lotsaram »

You can make your rule more generic and maintenance free by adding a "last year" and "next year" attribute to the year dimension. That would be better than what you have.

But the real question for this calculation is not rule vs. TI it should be rule vs. dimension consolidation. Any time you have a calculation that is mono-dimensional addition or subtraction the most performant calculation method is consolidation not rule. YoY variance is also a generic concept, it is no more exclusive to commission than it is to 2016 vs. 2015; it applies to all measures across all years. If you create a "2016 PY Var" consolidation with children 2016 with weight 1 and 2015 with weight -1 then you have solved the problem without rule or TI. Now repeat for all YoY pairs. Now it is a generic calculation for all measures not just commission and it is a generic calculation for all cubes where the year dimension is re-used with no overhead and no further maintenance.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
User avatar
jim wood
Site Admin
Posts: 3961
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: YTD difference - rule or TI?

Post by jim wood »

A very good point Lotsaram. I guess what would help answer the question either way (which I wasn't clear on via the first post. I did read first thing in the morning mind) is whether you need the YTD difference for every year or only the current year?
Struggling through the quagmire of life to reach the other side of who knows where.
Go Build a PC
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
User avatar
paulsimon
MVP
Posts: 808
Joined: Sat Sep 03, 2011 11:10 pm
OLAP Product: TM1
Version: PA 2.0.5
Excel Version: 2016
Contact:

Re: YTD difference - rule or TI?

Post by paulsimon »

Hi

I few other points to mention.

I would avoid using '1' for a Period Name - best to use 'P01'. The reason being that as soon as you go out to Excel, any numeric code will get treated as a number.

To do the YTD Difference with separate Year and Period dimensions you will need the 2016 PY Var (2016 - 2015) consolidation that Lotsaram suggested. It perhaps was not clear that you will also need YTD consolidations in the Period dimension, eg P01_YTD is a consol of P01, P02_YTD is a consol of P01 and P02, etc. In that way you will can select the appropriate PY Var consolidation in Year and the appropriate YTD consolidation in Period to get the Year on Year YTD Difference.

If you are still at the early stages of designing your cube I would also recommend that you consider a single Year_Period dimension, as this will then allow you to do Cumulative to Date, Rolling 12 Months, Prior Period, etc, all just by consolidation. There are various ways of generating this.

Regards

Paul Simon
wigglyrat
Posts: 67
Joined: Wed Sep 02, 2015 3:09 pm
OLAP Product: TM1
Version: 10_2_2
Excel Version: 2010

Re: YTD difference - rule or TI?

Post by wigglyrat »

I have tried consolidation and it worked perfectly. Thank you to everyone for your help.
Post Reply