How to get Last Year Sales and YTD Sales without using AGO and TODATE?

Hi all,
I have got Company and Time dimensions and Sales Fact. My requirement is to get Last Year sales for each company without using AGO function and YTD without using TODATE function. (Due to performance issue as AGO and TODATE do not insert a Cache entry).
Can someone please help me to achieve my requirement? Thanks in advance.

Hi Satya,
Thanks again for your reply. To start with I don't have data for the years 2012 and 2011 to test as I am using SH sample schema from Oracle. I have applied your solution but it does not seem to be working for the previous years like 2000, 2001. My requirement is to have a dashboard prompt "YEAR" and let the user choose whatever year he wants.
Please have a look at the column formulas of my analysis (As per your solution) :
***here B_YEAR is replaced by CALENDAR_YEAR.  
Amount: "F1 Sales"."Amount"
AmountYTD:  FILTER("F1 Sales"."Amount" USING "D1 Time"."CALENDAR_YEAR" =YEAR(CURRENT_DATE))
Amount LY: FILTER("F1 Sales"."Amount" USING "D1 Time"."CALENDAR_YEAR" =YEAR(CURRENT_DATE)-1)and the physical query generated by BI Server: (as you can see I have got a filter CALENDAR_YEAR= 2000)
WITH
SAWITH0 AS (select sum(T1074.AMOUNT_SOLD) as c1,
     sum(case  when T1035.CALENDAR_YEAR = TO_NUMBER(TO_CHAR(TO_DATE('2012-05-03' , 'YYYY-MM-DD'), 'yyyy'), '9999') then T1074.AMOUNT_SOLD end ) as c2,
     sum(case  when TO_NUMBER(TO_CHAR(TO_DATE('2012-05-03' , 'YYYY-MM-DD'), 'yyyy'), '9999') - 1 = T1035.CALENDAR_YEAR then T1074.AMOUNT_SOLD end ) as c3,
     T1035.CALENDAR_MONTH_DESC as c4,
     T1035.CALENDAR_YEAR as c5,
     T1035.CALENDAR_MONTH_ID as c6
from
     TIMES T1035 /* D1 Time */ ,
     SALES T1074 /* F1 Sales */
where  ( T1035.CALENDAR_YEAR = 2000 and T1035.TIME_ID = T1074.TIME_ID )
group by T1035.CALENDAR_MONTH_DESC, T1035.CALENDAR_MONTH_ID, T1035.CALENDAR_YEAR)
select distinct 0 as c1,
     D1.c4 as c2,
     D1.c5 as c3,
     D1.c1 as c4,
     D1.c2 as c5,
     D1.c3 as c6,
     D1.c6 as c7
from
     SAWITH0 D1
order by c3, c2 Thanks in advance.

Similar Messages

  • Javascript array ;Add and remove elements without using push and pop

    Hi
     I need to perform add and remove  operation in Javascript with following scenarios
    i) Add element, if element does not exist in array(javascript)
    ii) Remove element, if element exist in array(javascript)
    Without using push and pop method how to achieve this?
    Regards
    Siva

    Completed the Scenario.

  • How to get last year records in P&L

    Hii gurus,
    I am creating Profit & Loss report.
    I need to show last year records.
    Please explain.....
    Thanks in advance......
    Moderator message: please do more research before asking, show what you have done yourself when asking.
    Edited by: Thomas Zloch on Sep 27, 2011 2:11 PM

    Hi,
    Better still if you want this to be easily changeable, i.e. not without a repository migration, put the search spec on the Applet in the Application - Personalization screen. In this way you can change the Search Spec in case of Business Requirement change without needing to go through a development cycle. Do not forget to do a Reload Personalization Rules after changing Search Spec to bring this in effect.
    If you have a standard requirement then do it preferably on the Applet so that you can use the BusComp at other locations also without having to deal with the search spec coming in uninvited.
    Thanks and Regards,
    Tanmay Jain.

  • How to get the values in a single row without using union

    Hi,
    I have a table with the following structure and data
    empid     address     phoneno     emailid
    1001     xyz          
    1001          1234234     
    1001               [email protected]
    1002          23434     
    1002               [email protected]
    1003     abcd          
    1003               [email protected]
    1004               [email protected]
    I need to have a result in this format.
    emp id     address     phoneno     emailid
    1001     xyz     1234234     [email protected]
    1002          23434     [email protected]
    1003     abcd          [email protected]
    1004               [email protected]
    I can do it using union however that gives a performance issues with a large table. So I wish to do using in any other way using lead or something, but with the complexity about the data, I couldn't do it.
    Can anyone please help me?
    Natarajan
    Edited by: Nattu on Dec 3, 2009 3:50 PM

    Select employee_id, max(address), max(phone), max(email)
    from emp
    group by employee_id;Max

  • How do I completely turn off the backlit keyboard without using F5 and F6?

    I believe my keyboard short circuited after a spill this weekend. I'm currently using a usb keyboard from Apple. I have disabled the keyboard, on my laptop, now I want to completely turn off the backlight. I've looked in the settings and can't seem to find anything. Thanks.

    hi mtbomb,
    hi Can you while the Power LED is blinking hold the power down don't let it go until the light disappeared.
      Technically the Yoga13 should turn off while holding down the power. at least 10 to 15 sec.
    I would suggest calling Technical Support if the above steps did not resolve the issue.
      It's possible that when you turn on the system, it is not going to sleep but the blinking indicates failure.
    Best regards
    Solid Cruver
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • How Achieve timedseries calculations with out using AGO And ToDate function

    Hi,,
    1)
    How Achieve timedseries calculations with out using AGO And ToDate functionion
    this question asking in interview ..is it possible..?
    if yes please response as soon as possible..
    2) i have 2 cloumns Product and value...
    client requirement is they need ranks based on Value ..in dashboard .using dashboard prompt..edit box...if user enter any number (ex :5 ) report should show top 5 ranks if he enter 20 should be top 20 ranks..
    how to achive this ?
    thanks,
    raj

    Consider yor first question:
    1. Yes, we can create timeseries measures without using AGO and TODATE
    1. Create ALIAS of fact tabe in the physical layer
    2. Join the Time id from the ALIAS fact table with the YAGO_MONTH_ID column from your time dimension table (For calculating Year Ago variants) similarly join with MAGO_MONTH_ID column for Month Ago measures.
    3.Pull the ALIAS tables as an additional Logical table source in the Lgical layer
    4.Keep the mapping of the columns from the ALIAS table as its is
    5. For e.g If you pick Revenue from the Year Ago Alias table it will give you the "Prior Year Revenue"
    See if this helps you

  • HT1296 How can I transfer my ipad calendar to my iphone and ipod touch without using gmail?

    How can I transfer the Calendar on my ipad2 to my iphone5 and ipod touch without using gmail, and keep them synced?

    You could use iCloud, or you could sync them through iTunes on a Mac or a Windows computer.

  • Getting last year sale , this year sale and getting there percentage

    Hi,
    I am using three query in my report
    first query : to get this year actual sales
    second query : to get last year actual sales
    third query : to get target sales
    my first query is
    select t.branch_cd,b.branch_e_name,t.vndr#,v.vndr_name,
    sum(nvl(t.sales_actl_amt,0)) sales_actl_amt
    from inv_sales_trgt_val t,branches b,vendor v where
    t.branch_cd=b.branch_cd and
    t.vndr#=v.vndr# and
    (t.yymm between :fiscal_month and :fiscal_month2) and
    (:fiscal_month<>trunc(:fiscal_month2,-2)) and :fiscal_month2<>trunc(:fiscal_month2,-2)) and t.branch_cd between :from_branch and to_branch and
    t.vndr# between :from_vndr and :to_vndr
    group by t.vndr#,v.vndr_name,t.branch_cd,b.branch_e_name
    order by t.vndr#,t.branch_cd;
    my second query
    select t.branch_cd,b.branch_e_name,t.vndr#,v.vndr_name,
    sum(nvl(t.sales_actl_amt,0)) sales_actl_amt0 ,
    sum(nvl(t.sales_actl_amt,0)) last_year_sales_actl_amt
    from inv_sales_trgt_val t,branches b,vendor v where
    t.branch_cd=b.branch_cd and
    t.vndr#=v.vndr# and
    (t.yymm between :fiscal_month-100 and :fiscal_month2-100) and
    (:fiscal_month<>trunc(:fiscal_month2,-2)) and :fiscal_month2<>trunc(:fiscal_month2,-2)) and t.branch_cd between :from_branch and to_branch and
    t.vndr# between :from_vndr and :to_vndr
    group by t.vndr#,v.vndr_name,t.branch_cd,b.branch_e_name
    order by t.vndr#,t.branch_cd;
    and my third query is
    select t.branch_cd,b.branch_e_name,t.vndr#,v.vndr_name,
    sum(nvl(t.sales_actl_amt,0)) sales_actl_amt ,
    sum(nvl(t.sales_trgt_amt,0)) sales_trgt_amt
    from inv_sales_trgt_val t,branches b,vendor v where
    t.branch_cd=b.branch_cd and
    t.vndr#=v.vndr# and
    (t.yymm between :fiscal_month and :fiscal_month2) and
    (:fiscal_month<>trunc(:fiscal_month2,-2)) and :fiscal_month2<>trunc(:fiscal_month2,-2)) and t.branch_cd between :from_branch and to_branch and
    t.vndr# between :from_vndr and :to_vndr
    group by t.vndr#,v.vndr_name,t.branch_cd,b.branch_e_name
    order by t.vndr#,t.branch_cd;
    in second query i am created two summary column and one place holder column and one formula column to get the percentage % :
    cs_3=sales_actl_amt
    cs_4=last_year_sales_actl_amt
    cp_2
    cf_1(example :cp_2=cs_3/cs_4)
    I am getting all 100 percentage.
    in the third query i created two summary column and one place holder column and one formula column to get the percentage % :
    cs_1=sales_actl_amt
    cs_2=last_year_sales_trgt_amt
    cp_1
    cf_1(example :cp_1=cs_1/cs_2)
    Here i am getting correct percentage
    I need to get cf_1 percentage but it is getting 100 for all
    its urgent please help.
    thank you.

    Create three restricted key figures.
    In one restrict month by current month.
    In other use offset of -12 and -24 while restricting current month.

  • To get last year Net Value by fiscal period

    Dear experts,
    Since yesterday am trying to get solution where still unable to succeed.The report requirement is that they need Planned sales and actual sales qty of current fiscal year/period wise and in first column to get last year Actual sales for same period.(Ex:009.2006 to 011.2006 is input and in first coloumn 009.2005 to 011.2005)
    This is the situation:
    I have kept restricted W2 for fiscal year varient in filter and have created quantity sales(for last year) RKF with variable as "From fiscal year/period-13 and To Fiscal year/period-1"(with offset) and have placed in Key Figure structure in column section.Above this Structure have kept Fiscal year/period info object with variable "From Fiscal Year/period to To Fiscal year/period.This is because i need period wise breakup.
    I understand that above we have "From Fiscal year/period infoobject" and below that in key figure structure u have the above quoted key figure with quantity sales of previous year.I want period wise it has to show me last year(period wise) quantity with current year Planned aty and sales Qty
    Have gone through all threads and now it feels that i should to for variable exit ?...Do i have any option apart from variable exit?...If so could anybody can provide code for the same...Kindly gimme solution.
    Maximum points will be awarded..
    Thanks and Rgds
    Chandru

    Hi,
    I hope, you are entering  values 009.2006 to 011.2006 for the variable "From Fiscal Year/period to To Fiscal year/period". Am I right?
    If so, Donot restrict the fiscal year period with "From Fiscal Year/period to To Fiscal year/period like as you mentioned:--
    <i>Above this Structure have kept Fiscal year/period info object with variable "From Fiscal Year/period to To Fiscal year/period.This is because i need period wise breakup.</i>
    To get the break up Priod wise, taking Fiscal year period characterstics above  the structure is sufficient with ou any restriction.
    Under the characterstic fiscal year period take two KF (same kf called SALES QTY two times with different heading like " last year Actual sales" and "current year Actual sales ") . First KF will be restricted with customer exit varible on Fiscal year period characterstic. Second KF will be restricted with user entry varible on Fiscal year period characterstic.
    In case if you enter the value 009.2006 to 011.2006 as the iput to user entry varible, the code should generate the value 009.2005 to 011.2005 to Customer exit varible.
    With rgds,
    Anil Kumar Sharma .P
    With rgds,
    Anil Kumar Sharma. P

  • Getting last year column value from a single table

    I am having the following columns in my table
    BRANCH_CD
    YYMM
    VNDR#
    VGROUP#
    SALES_TRGT_AMT
    SALES_ACTL_AMT
    CUM_TRGT_AMT
    CUM_ACTL_AMT
    i need to get sales_actl_amt from this year and sales_actl_amt from last year from a single table
    pls help
    thank you
    Edited by: 960991 on Nov 19, 2012 11:13 PM

    Hi ashish,
    but i can't use unions in my reports.
    once view my query :
    select t.branch_cd,b.branch_e_name,t.vndr#,v.vndr_name,
    sum(nvl(t.sales_actl_amt,0)) sales_actl_amt
    from inv_sales_trgt_val t,branches b,vendor v where
    t.branch_cd=b.branch_cd and
    t.vndr#=v.vndr# and
    (t.yymm between :fiscal_month and :fiscal_month2) and
    (:fiscal_month<>trunc(:fiscal_month2,-2)) and :fiscal_month2<>trunc(:fiscal_month2,-2)) and t.branch_cd between :from_branch and to_branch and
    t.vndr# between :from_vndr and :to_vndr
    group by t.vndr#,v.vndr_name,t.branch_cd,b.branch_e_name
    order by t.vndr#,t.branch_cd;
    how can i get last year sales_actl_amt .

  • Using Fiscal/Year Period to get last year all months data

    Hi,
    Had a requirement to get Last Years 1-12 months data based on Fiscal/Year Period. So here i am using Fiscal/Year period as my input. Please let me know with code.
    Regards,
    Vishnu

    Hi ,
    Where you want to write code ?
    Well the basic logic will be like :
    TYPES: BEGIN OF ty_range,
    sign TYPE c LENGTH 1,
    option TYPE c LENGTH 2,
    low TYPE c LENGTH 8,
    high TYPE c LENGTH 8,
    END OF ty_range.
    DATA : t_range TYPE TABLE OF ty_range,
    w_range LIKE LINE OF t_range.
    DATA :v_lastyear type c length 4  .
    v_lastyear = sy-datum(4) - 1 .
    w_range-sign = 'I'.
    w_range-option = 'EQ'.
    concatenate  v_lastyear '001'  t into w_range-low.
    concatenate  v_lastyear '012'  t into w_range-high.
    APPEND w_range TO t_range.
    ****it will select data from source package for last one year .Internally year and period store like YYYYPPP  (2011001)
    select  SOURCE_PACKAGE WHERE 0fiscper  IN t_range.
    you can modify selection statement as per your requirement .
    hope this will be helpful .
    Regards,
    Jaya Tiwari

  • How to get last column used in report sorting?

    hi,
    how to get last column used in report sorting?
    simon

    How to identifiy which column was sorted having different reports on page?
    just use:
    'YOUR_STATIC_REGION_NAME' instead of p_static_id,
    :APP_ID for p_app_id,
    :APP_PAGE_ID for p_page_id
    :APP_USER_ID for p_app_user.
    and dont forget to grant SELECT on #OWNER# to APEX_030200.WWV_FLOW_PREFERENCES$
    good luck and thank you Juergen.Schuster
    Simon

  • How to get last date of the week

    hi,
    how to get last date of the week like FM WEEK_GET_FIRST_DAY gives the date of the first day of the week i need the date of the last day of the week..
    thnx

    data : p_week type KWEEK,
    p_Date type SYDATUM.
    p_week = <incoming value in week of year>
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
    EXPORTING
    week = p_week
    IMPORTING
    DATE = p_date
    EXCEPTIONS
    WEEK_INVALID = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To get the last day of the week.
    p_date = p_date + 6.
    You can find the available fm in the system from se37 transaction code.

  • How to get the delivery number for the sales order

    hi
    how to get the delivery number for the sales order

    Hi,
    1. IN VA03, enter the sales order and click on the document flow button. From there you can check the delivery document.
    2. In SE11, enter VBFA(Document flow) table and enter the sales order in VBELV field and in VBTYP_N field enter 'J' to specify that you want to check if there is already a delivery document for that sales order.
    Hope it helps...
    P.S. Please award points if it helps...

  • How to get last Build date of a dll in the real time target

    Info On My Project    
       I am working on LabWindows CVI 12.0 for development . This project is a real time application for hardware, which is having Phar Lap ETS as RTOS...  
    I am facing some problems while checking Build date of my Application file( .dll)
    I have tried to use GetFileDate API. But it is not supporting for realtime Target..
    So i have tried __DATE__ macro.. That also having some problems..
    How to get last Build date of a dll from the real time target  ??
    Please Help to solve this....
    Thanks
    Vaishakh A  K

    Please reply if any one have suggestion...

Maybe you are looking for

  • Data betwen PSA and Cube

    Hi experts, I can see data in all the fields in PSA, but I don't see data for some of the fields in the Cube. The DTP ran succesfully and double checked transformations are mapped correctly. I am struggling to understand why this is happening? Please

  • InfoSpoke Destination.

    Hi Gurus InfoSpoke Destination. I have a problem with the InfoSpoke Destination. I need to change the statical path to dynamic path, so I can transport the path without altering the path after the import to Q and P. Currently I am using File Name as

  • XI Adapter Framework Error in SXMB_MONI

    Hi Experts,   i am getting below error in MONI. Could any one please advice me what is the problem... *<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>* *- <!--  Inbound Message*   --> - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30"

  • How to handle empty boxes to fill a pallet layer in Packing Instructions

    Hi, I would like to know if it is possible to automatically add empty boxes in an outbound delivery of finished goods when the delivery is complete. e.g.  In the packing Instructions I have the following 1 Pallet 12 boxes of finished goods ( 4 boxes

  • Social media...

    hello, I was just wondering if it is possible to use this product as a "start up" for a social networking site? 2nd can you edit the source code of flash media server? And when i mean can you use it for social networking development i mean , low qual