Generalizing YTD & QTD calculations

Hi,
I am having month as leaf level in the time table. There are 14 months each month is having 26 days in the time table.
Time table format:
TIME_KEY     PERIOD_NAME        START_DATE     END_DATE     YEAR_START_DATE     QUARTER_START_DATE PERIOD_YEAR      PERIOD_NUM     QUARTER_NUM
200701     JAN-07     12/30/2006     1/26/2007     12/30/2006     12/30/2006     2007     1     1
200702     FEB-07     1/27/2007     2/23/2007     12/30/2006     12/30/2006     2007     2     1
200703     MAR-07     2/24/2007     3/30/2007     12/30/2006     12/30/2006     2007     3     1
200704     APR-07     3/31/2007     4/27/2007     12/30/2006     3/31/2007     2007     4     2
200705     MAY-07     4/28/2007     5/25/2007     12/30/2006     3/31/2007     2007     5     2
200706     JUN-07     5/26/2007     6/29/2007     12/30/2006     3/31/2007     2007     6     2
200707     JUL-07     6/30/2007     7/27/2007     12/30/2006     6/30/2007     2007     7     3
200708     AUG-07     7/28/2007     8/24/2007     12/30/2006     6/30/2007     2007     8     3
200709     SEP-07     8/25/2007     9/28/2007     12/30/2006     6/30/2007     2007     9     3
200710     OCT-07     9/29/2007     10/26/2007     12/30/2006     9/29/2007     2007     10     4
200711     NOV-07     10/27/2007     11/23/2007     12/30/2006     9/29/2007     2007     11     4
200712     DEC-07     11/24/2007     12/28/2007     12/30/2006     9/29/2007     2007     12     4
200713     P13-07     12/28/2007     12/28/2007     12/30/2006     9/29/2007     2007     13     4
200714     P14-07     12/28/2007     12/28/2007     12/30/2006     9/29/2007     2007     14     4
200801     JAN-08     12/29/2007     1/25/2008     12/29/2007     12/29/2007     2008     1     1
200802     FEB-08     1/26/2008     2/22/2008     12/29/2007     12/29/2007     2008     2     1
200803     MAR-08     2/23/2008     3/28/2008     12/29/2007     12/29/2007     2008     3     1
200804     APR-08     3/29/2008     4/25/2008     12/29/2007     3/29/2008     2008     4     2
200805     MAY-08     4/26/2008     5/23/2008     12/29/2007     3/29/2008     2008     5     2
200806     JUN-08     5/24/2008     6/27/2008     12/29/2007     3/29/2008     2008     6     2
200807     JUL-08     6/28/2008     7/25/2008     12/29/2007     6/28/2008     2008     7     3
200808     AUG-08     7/26/2008     8/22/2008     12/29/2007     6/28/2008     2008     8     3
200809     SEP-08     8/23/2008     9/26/2008     12/29/2007     6/28/2008     2008     9     3
200810     OCT-08     9/27/2008     10/24/2008     12/29/2007     9/27/2008     2008     10     4
200811     NOV-08     10/25/2008     11/21/2008     12/29/2007     9/27/2008     2008     11     4
200812     DEC-08     11/22/2008     12/26/2008     12/29/2007     9/27/2008     2008     12     4
200813     P13-08     12/26/2008     12/26/2008     12/29/2007     9/27/2008     2008     13     4
200814     P14-08     12/26/2008     12/26/2008     12/29/2007     9/27/2008     2008     14     4
I am using TIME_KEY column (which is integer) in the calculations. The YTD & QTD calculations are as follows,
YTD calculation in Universe:
Select section:
Sum (Actual)
Where section:
(D_TIME.TIME_KEY
Between     
to_number(Concat(Substr(to_char(@Prompt('Enter End Period: ', 'A', 'Dim Time\YearPeriod', Mono, Constrained), '999999'),1,5),'01'), '999999')
And
@Prompt ('Enter End Period: ', 'A', 'Dim Time\YearPeriod', Mono, Constrained))
QTD calculation in Universe:
Select section:
Sum (Actual)
Where section:
(D_TIME.TIME_KEY
Between
to_number(Concat(Substr(to_char(@Prompt('Enter End Period: ', 'A', 'Dim Time\YearPeriod', Mono, Constrained), '999999'), 1, 5),
(Case Substr(to_char(@Prompt('Enter End Period: ', 'A', 'Dim Time\YearPeriod' ,Mono, Constrained), '999999'), 6, 7)     
           When '01' Then '01'
           When '02' Then '01'
           When '03' Then '01'
           When '04' Then '04'
           When '05' Then '04'
           When '06' Then '04'
           When '07' Then '07'
           When '08' Then '07'
           When '09' Then '07'
           When '10' Then '10'
           When '11' Then '10'
           When '12' Then '10' 
When '13' Then '10' 
When '14' Then '10'
      End)), '999999')
And
@Prompt ('Enter End Period: ', 'A',' Dim Time\YearPeriod', Mono, Constrained))
Using the above YTD & QTD calculations, I can restrict the periods but the values are not rolling up for each month. For example,
Period level data:
________Jan-10____Feb-10____Mar-10
Product 1___2________4_________6
YTD: (the output has to come like the below one, but I am getting the same period value)
________Jan-10____Feb-10____Mar-10
Product 1___2________6_________12
Please guide me to write a generalized YTD and QTD calculation in Universe level?
Regards, Sujeev

Hi Mark,
Thanks for your reply.
I made the changes as per your suggestion. I am not getting the values for the YTD, instead i am getting zero values for all the periods. How to solve this issue. But my previous YTD calculation is giving me the value like as follows,
*Period level data:*
________Jan-10____Feb-10____Mar-10
Product 1___2________4_________6
But i want the YTD function to perform like,
*YTD:*
________Jan-10____Feb-10____Mar-10
Product 1___2________6_________12
YTD calculation for individual months has to be like as follow,
Jan = Jan
Feb = Jan + Feb
Mar = Jan + Feb + Mar...
How to do it?
Regards, Sujeev

Similar Messages

  • Please help me in Calculating Sybase IQ Daily,WTD,MTD, YTD,QTD,SPLM,SPLY

    Hi Team,
    Need to Calculate No of Customers from a particular dimension table on these measures Daily,WTD,MTD, YTD,QTD,SPLM,SPLY
    Can anybody help me with the Logic its extremely urgent.
    Thanks all for your help
    Regards,
    Yedu

    Is that part of an entire script, I don't see the tokens changing as TimG observed is this being called from a different routine. (are you calling the same script using a for loop?)
    I think instead of updating the subvar everytime, he just used a bat/sh script to run it for various members.
    Regards
    Celvin
    http://www.orahyplabs.com

  • Ytd , qtd and mtd

    Hi All,
    I am facing the problem when creating the ytd,qtd and mtd . I have 3 levels in my period dim table like year , quarter and month. I have a doubt on which leve i have specify the Chronology key.
    In this dim table i have a composite primary key on two columns . Those are year and monthkey. How can i define to the lowest level .
    Pls advise me , I would be very thank ful to you.

    In my period dim they have taken year and monthkey is the primary key. That's why we call it as a composite primar key. right.
    But here i am confusing shall i take these two column in the lowest level of hierachy or not
    I am getting the quaters for all the years the same result.
    Pls advise me

  • YTD,QTD & MTD values for variable under 0CALMONTH

    Hi Gurus,
    I need to calculate YTD,QTD & MTD values for a KF based on the value that the user enters in the variable under 0CALMONTH.
    I have the code for how it can be done using 0CALDAY but not sure for 0CALMONTH.
    Can you share the ABAP code for this requirement.
    Your help will be greatly appreciated.
    Thanks
    Arvind

    Hi,
    Based on the month entered by the user, take First day of the month in teh exit,
    1. YTD :  Take SY-DATUM and calculate YTD
    2. QTD :  Based on the Month you calculate Quarter
    3. MTD :  Take SY-DATUM and calculate MTD
    *Note: * If they give only Month want to date meanes, only SY-DATUM will be accepeted, because they are not passing 0CALDAY
    Thanks
    Reddy

  • OBIEE MTD, YTD, QTD Functions for an accumulating snapshot fact

    Hello all,
    I would be really grateful if someone can help me out with this:
    I have an accumulating snapshot fact with the foll fields:
    SALE(Sale_date, Org_ID, Proj_ID, Emp_ID, Cust_ID, Amt, Eff_St_Dt, Eff_End_Dt)
    Now because it's an accumulating snapshot, there are multiple entries but with different date_stamps. For example a sale was booked on 1-JAN-2010 as $30,000 but was updated in Feb 2010 to $45,000.
    This is my question: the MTD, QTD and YTD time series calculations all calculate with 2 parameters, the fact and the time dimension.
    How do I calculate the XTD values with sale_date and the effective_dates in mind? because now I have more than just the time dimension. Can anyone suggest how it will be calculated?
    Thanks,
    Abhishek

    Hi Kishore,
    I made a change over here and the error is not occuring now. But different error is occuring.
    Instead of year (which is default root level in Dimension), I picked either Month or Quarter and I am not facing the error (Invalid Expression).
    I have a questions now
    1) is it that we cannot use a column defined as Default Root level in Todate and AGO functions?
    The other part is I have a new error ([nQSError: 22038] Function TODATE requires at least one measure attribute in its first argument.)
    My fact column (FACT Table as partner_id,Id (primary_key) and ..). For the fact column to be the first parameter is that is should have some aggregation rule?
    Please let me know...
    Thanking you in Advance
    Regards
    (S.Prashant)

  • YTD, QTD and Year grain metrics = ORA-00942: table or view does not exist

    Hi everyone,
    I'm having a weird issue. I've got some GL data that I want to report on in three different grains: Quarter To Date, Year To Date and Entire Year. For the first two measures, I've setup a time dimension and I'm using the ToDate function. Works perfectly. For the third measure, I select the SUM aggregation and then in the Levels Tab, I go to my time dimension and set the logical level to "Year".
    Each measure reports correctly by itself, however, when I join in the three in one report, the who thing blows up on me and gives me an ORA message:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 942, message: ORA-00942: table or view does not exist at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)
    When I only do two of the measures (any two), the report works fine. But it's when I add that third measure in, I get myself in trouble. Additionally, I checked the log file and the report never gets to the point where it generates a physical query. It's only creating a logical query and then it doesn't save the physical query anywhere.
    Can anyone explain what the problem is? Why don't these three measures behave well together? What can I do to force them to co-operate?
    It seems that the real culprit is the entire year measure. It only behaves well with 1 other measure, but once you get two additional measures, it causes the report to get the ORA error.
    Thanks for any help you can give!
    -Joe

    It turns out I was incorrect that there were no physical queries being generated. They were there in the log files, they had so many SAWITH<number> clauses that I thought they were the logical query (i.e. saw_0, saw_1, etc).
    Once I found the physical query, I ran it by hand and also got the table did not exist error. I added in WITH clause by with clause until I got the error to occur. After about an hour of digging, it turned out that a query using a full outer join (about 16 queries in) caused the table does not exist error. I'm not sure what it is about the full outer join that makes Oracle not see the table. When I get some free time I'll dig deeper into that issue.
    But once I realized what was going on, I went into the DB connections and disabled FULL OUTER JOINs. No problem now.
    Like I said, if I find what caused the original problem (i.e. what syntactically was incorrect about the FULL OUTER JOIN), I'll update this post.
    -Joe

  • Like ytd,qtd

    Hi
    i am struglling in this
    i create 3 reports monthly,qurterly,yearly
    one prompt month,year
    if we select month year then like nov 2012
    1st report show upto nov2012
    2nd report show quarter sum upto nov2012
    year show previous years,2012 like 2012,2011,2012

    I'm sure there is a smarter solution than this, but this one coudl at least "do". Define two columns in your answers query, the first one for your
    - actual quarter: FILTER("SALES"."AMOUNT" USING ("DIM_TIME"."YEAR"=YEAR(CURRENT_DATE) AND "DIM_TIME"."QUARTER"= QUARTER(CURRENT_DATE) AND "DIM_TIME"."MONTH"<MONTH(CURRENT_DATE)))
    and a second one for
    - last year quarter: FILTER("SALES"."AMOUNT" USING ("DIM_TIME"."YEAR"=YEAR(CURRENT_DATE)-1 AND "DIM_TIME"."QUARTER"= QUARTER(CURRENT_DATE) AND "DIM_TIME"."MONTH"<MONTH(CURRENT_DATE) AND ))
    .

  • PTD and YTD in GL

    Hi,
    I have to display accounting information on my report. I'm new to GL. Does anyone knows how to calculate PTD and YTD in GL. I need to know the technical details. I'm aware of the tables but don't know the formula to calulate PTD and YTD.
    Please help.
    Thanks and Regards,
    Ravindra

    Hi;
    Please review:
    YTD & PTD
    YTD & QTD Calculation through Calculation Script
    Regard
    Helios

  • Ytd,ptd,qtd in dashboard prompt

    Hi
    how to use ptd,qtd,ytd as dashboard prompt
    i created netamount ptd,ytd,qtd in rpd
    my metric is netamount
    in dashboard if i select ptd then give ptd values
    selct ytd give ytd netamount
    qtd also same
    its in dashboard change all the reports in dashboard
    how to do this

    First try with single report and test whether its working. later you can implement for all the reports.
    Create Measssure
    "Your_table_name"."ptd" = Somr calculation i rpd
    "Your_table_name"."qtd" = Somr calculation i rpd
    "Your_table_name"."ytd" = Somr calculation i rpd
    Now you have 3 measures in the presentaion layer called ptd,qtd,ytd.
    Create report put the column like "Your_table_name"."@{var_mes}{ptd}" ( ptd as defalut meassure) save the report.
    Now create Dashboard Prompt . In that select Variable Prompt. In the right side of Presentaion Variable write as var_mes.
    Now select choice list then custom values, select values enter ptd .
    select values enter qtd and again ytd...........
    Now u have a presentation variable with 3 custom values , ptd,qtd,ytd
    Save the dashboard prompt.
    Put this dashboard prompt and Report in saingle dashboard. imitaialyy your report should show the value of ptd ( coz you have select ptd as default above in th column formula "Your_table_name"."@{var_mes}{ptd}" )
    Now wheh u cahnge the prompt, presentaion vraibale should go and maessuare should change.
    mark if correct/helps
    fiaz

  • Calculating YTD column in OBIEE 11g

    Hi ,
    Here is my requirement :
    I have to create a report , which shows several measure values (revenue , gross mergin etc as rows of a pivot table) against a certain period (Months , i.e. Jan , Feb ....etc as columns of a pivot table ) . Taking period prompt as presentation variable prompt . For example , If 'Jan' is selected from period dropdown list ,then only Jan values are shown . I am able to do upto this part .
    Next , I have to add one YTD column (calculated ) , which will eventually sum the values of upto selected period value , i.e if selected month is 'Mar' then March values will be shown in one column and 'Jan + Feb + Mar ' values will shown in another .
    How to achive this ?
    FYI , I am taking essbase 11.1.2.0 as datasource and using OBIEE 11.1.1.5.0 version .
    Thanks in advance.
    Edited by: 937268 on Jul 2, 2012 3:04 PM

    Hi,
    by using time series Ago function method and also by suing obiee-date-expression method you can solve it.
    YTD:
    http://download.oracle.com/docs/cd/E21764_01/bi.1111/e10540/dimensions.htm#i1023744
    http://gerardnico.com/wiki/dat/obiee/function_time
    http://www.vlamis.com/blog/2011/6/17/doing-time-series-calculations-in-answers-11g.html
    OBIEE - date expression method
    http://obieedue.blogspot.com/2011/06/obiee-date-expressions-reference.html
    Thanks
    Deva

  • DTS  Generation number to be assigned to  YTD and QTD

    Hello,
    I have a Periods dimension defined in one of your planning Apps as below . The question I have what is the generation number I have to associate for the YTD and QTD DTS members . In the documentation it says to assign 1 for Y-T-D and 2 for Q-T-D . This does not seem yeild correct results for Q-T-D .
    Vinod
    Periods (YTD,QTD)
    BegBalance (Generation 2)
    YearTotal (generation 2)
    |___ Q1 (generation 3)
    |_Jan (Generation 4)
    |_Feb (gen 4)
    |_mar (gen 4)
    |____Q2 (generation 3)
    |____Q3
    |____Q4
    Thanks
    V

    I got the solution for this........
    Edited by: Kumar on Dec 30, 2010 3:02 PM
    Edited by: Kumar on Dec 30, 2010 3:02 PM

  • YTD calculation from BEx is not working in Advance Analysis for OLAP/OR Office

    I have AA for OLAP based on BEx. There are YTD calculation in BEx Designer: User enters Period in variable, and in user exits, the Period Range is populated as "1 ~ UserEnteredValue" in second variable. In BEx, YTD is calculated based on the Restrictive KF for the period range, calculated in User Exit. This is working fine in BEx Analyzer, however in Advance Analysis (for OLAP OR in Ofice), the YTD value is not coming up they way it is in BEx Analyzer...
    Anybody has any clue, why??
    Thanking all of you in advance  

    Hello Sharma
    If something is working for BEx Analyzer but not for Analysis OLAP or Analysis Office then this typically (but not always) indicates an issue with the BICS (BI Consumer Services) component.
    I would suggest you contact support about this so the appropriate logs can be captured and the issue investigated by the BICS team.
    Regards
    Ian

  • Consolidation PTD/YTD

    On Consolidation Transfer Window you have the option to choose Amount Types (PTD/YTD)
    What I understood from this is you can consolidate either PTD or YTD balances (beside other types).
    I can see how PTD consolidation would work. PTD balances would be sent over to the Parent Ledger. Parent Ledger's YTD would be derived from this PTD activity.
    What I don't understand is that how YTD consolidation looks like? How would PTD balances be derived in Parent Ledger?
    Let me rephrase my question:
    Shouldn't always period net activity (PTD) be transferred over to the parent? All other balance types like YTD, QTD etc would be derived from this period net activity? If we transfer YTD instead then how would period net activity be derived in parent?

    A few things:WHat problem are you having with DTS? The calculation you describe looks like it could be solved with DTS without adding calculation overhead.Second, rather than create a new dimension, you could create an alternate rollup in your existing dimension, and use shared members to create the to-date totals.If you want to use a new dimension, you need 3 members in it, not 2:To Date - data - YTD - PTDYou need a placeholder to load the data into, then 2 members to apply the to date calculation to.The formula on YTD could look something like this:IF (@ISMBR (Jan)) YTD = data->Jan;ELSEIF (@ISMBR (Feb)) YTD = @SUMRANGE (data, Jan:Feb);... etc...ELSE YTD = @SUMRANGE (date, Jan:Dec);ENDIFThe formula takes the values stored in the data member and sums them across the appropriate range of months. The function for PTD could be similar, with slightly different logic.Hope that helps.Regards,Jade---------------------------------Jade ColeSenior Business Intelligence ConsultantClarity [email protected]

  • Better approach time series calculations

    Hi,
    I have a technical answer. In your opinion, to improve performances, is better calculate YTD, QTD, PY.... etc., values using Time Series functions available in OBIEE (YearToDatel, AGO, PERIODROLLING...) or put them in ETL Flow so OBIEE Server only must take results without any calculations?. Using OBIEE Functions the effort is less, but perhaps they create overhead for OBIEE Server so query time responses increase dramatically?
    Have you an example showing queries to perform to calculate Time Series Functions without OBIEE functions, so I can insert them in my ETL flows?
    Thanks
    Giancarlo

    OK,
    but it's better to have only one fact table containing columns for all measures I need (e.g. first column: YTD, second column: QTD, third column: MTD)... and so on (so i would have a LTS with only one Source table) or a distinct table for each measure (e.g. Table FACT_TABLE_A_YTD, FACT_TABLE_B_QTD and so on and combining them in a LTS having multiple Sources (FACT_TABLE (monthly), FACT_TABLE_A_YTD, FACT_TABLE_B_QTD)...
    Giancarlo

  • Step to calculate YTD and MTD in OBIEE

    Hi Experts
    I need to calculate YTD and MTD in OBIEE reports. Please tell me the steps how can i calculate .
    Thanks in advance
    Regards
    Frnds

    Hi..
    Sorry to say this, i am unable to write steps,
    but go through these links.. hope you can understand, if any problem occurs then post here.. we will check
    http://www.rittmanmead.com/2007/04/30/obi-ee-time-dimensions-and-time-series-calculations/
    http://oraclebizint.wordpress.com/2007/11/15/oracle-bi-ee-101332-understanding-todate-and-ago-achieving-mago-qago-and-yago/
    http://oraclebizint.wordpress.com/2007/11/05/oracle-bi-ee-101332-understanding-todate-and-ago-achieving-ytd-qtd-and-mtd/
    If you have any problem after doing these (i mean if any errors), then follow these...
    http://siebel.ittoolbox.com/groups/technical-functional/siebel-analytics-l/time-series-functions-in-obiee-please-asap-1654886
    http://siebel.ittoolbox.com/groups/technical-functional/siebel-analytics-l/help-with-todate-and-ago-time-series-functions-in-obiee-2347570
    Thanks & Regards
    Kishore Guggilla

Maybe you are looking for