Comparing successive years in a report

Hello!
I've tried to find answers to my dilemma, but so far either I have come up short, the instructions were not quite what I was looking for... or I just didn't understand the instructions.
My goal is to create a report that looks a bit like this:
2004 % 2005 % 2006 % 2007 %
100 NA 105 5% 125 19% 110 -12%
(Hard to edit it to look right...)
Anyways. I want to first list the actual values of a given field and then compare the difference to last years value and convert it to a percentage. The problem is that I just don't know how to get the previous year. I can manage to get the years just fine in a pivot table. It's pretty standard really, but the comparison of the two successive years eludes me.
I have a self created time dimension, which has unique chronological keys for year, month and days.
The "best thing so far" I did in my opinion was, that I added a new logical column called "edkont", which was supposed to be the sum of the previous years field. I then proceeded to edit the aggregation rule and used the AGO-function like this:
AGO(Dw_tgt.Kontakti.Edkont, Dw_tgt.AikaDim.Vuosi, 1)
Converted to english (for clarity) this should look something like:
AGO(Dw_tgt.Contact.PrevCont, Dw_tgt.TimeDim.Year, 1)
Now when I put this in the Expression builder, it gives me an error "You must use standard aggregate functions."
Fair enough, I try to use this:
AGO(SUM(Dw_tgt.Kontakti.Edkont), Dw_tgt.AikaDim.Vuosi, 1)
Same error. I even tried the following:
SUM(AGO(Dw_tgt.Kontakti.Edkont, Dw_tgt.AikaDim.Vuosi, 1))
This time it just says Invalid Expression.
So that's my problem. I'd really appreciate any help on the topic.
Regards,
Erik

Okay. I resolved a part of the issue.
The problem was with the time dimension. I had set up the chronological keys badly.
Now however I'm faced with a new problem. I've created some new logical columns with the AGO-function and the percentage column also. And they seem to work just fine, yay!! Except for one thing.
The problem however becomes that when I try to put the percentage columns to a pivot table as a measure, it won't load.
For example, I can put up the Year Ago Contacts up as a measure column and that's fine, but when I try to put the "change from last year as a percentage" -column... it stops the query when it tries to retrieve the pivot table results and gives the following error 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)
SQL Issued: SELECT Aika.Vuosi saw_0, Palveluryhma."Palveluryhmä" saw_1, Kontakti."Kontakti lkm" saw_2, Kontakti."Viime vuoden kont sum" saw_3, Kontakti."Viime vuoden kont %" saw_4, Kontakti."Asiakas lkm" saw_5, Palveluryhma."Palveluryhmä nro" saw_6, AGGREGATE(saw_4 BY saw_0), AGGREGATE(saw_5 BY saw_0) FROM Pegasos WHERE (Palveluryhma."Palveluryhmä nro" BETWEEN 1 AND 10) AND (Aika.Vuosi > 2004) AND (Aika.Vuosi < 2009) ORDER BY saw_0, saw_1, saw_6
I tried to set them up in other pivot tables too and sometimes they work, sometimes they don't. But mostly they just give me the similar error message. Any ideas anyone?
Regards,
Erik

Similar Messages

  • Multi-year monthly CO report for Actual/Budget/Variance

    I have a requirement of creating a 5-year cost centre report for the following:
    Actual by month (5 years x 12)
    Budget by month (5 years x 12)
    % of the monthly amounts compared to the total (5 years x 12)
    Variance (5 years x 12)
    The request is at the cost element level, by month and for 5 years.  I am trying to decide which reporting tool is appropriate for this request.  If I use the conventional CO report format (report painter) of one column per month for actual/budget/actual %/variance, there will be a lots of columns for 5 years!
    I am familiar with reporting tools of report painter, drill-down and SAP query, although I am not sure if drill-down can be used for CCA.  Would appreciate any suggestion for: 
    1) Reporting tools for multi-year output; and
    2) Report format u2013 example of existing SAP-delivered report

    Do you intend to use a report with 240 columns? I am wondering what would be the purpose of such a large column report.
    Still if needed, you could try with painter itself, may be using page break perhaps. I am not sure of the limitation to the number of column.

  • Comparing two dates in a report

    Hello,
    I am attempting to compare two dates in a report in order to format a column. My code for that portion of the report is as follows:
    CASE
       WHEN TO_DATE(DATE_DUE,'DD-MON-YYYY') -
            TO_DATE(sysdate,'DD-MON-YYYY') <= 5 THEN
              '<span class="due">'||DATE_DUE||'</span>'
       ELSE
          DATE_DUE
    END AS DATE_DUE,I'm getting the error message ORA-00932: inconsistent datatypes: expected CHAR got DATE.
    I've been trying to fix the condition to get rid of the error with no success.
    Thanks
    -Brian

    One thing I just noticed that may or may not be the problem is that your case statement is returning two different datatypes depending on the condition. In one part, it is returning a character string of the span tags concatenated with the due_date (which in and of itself are incompatible datatypes) and the second part is returning just a date.
    Again, not sure if the SQL engine will do automatic conversions for you, but this seems to jive with your "char vs. date" error.

  • Can i get month, quarterly, half yearly, yearly wise sales report basing on

    hi,
    sap gurus,
    good evening to all,
    how can i get month, quarterly, half yearly, yearly wise sales report basing on division and material.
    is there any std transaction code for that.
    customization is requried for that.
    regards,
    balaji.t
    09990019711

    Standard SAP SD Reports:=
    Statistic Group:
    Purpose u2013 To capture data for Standard Reports, we require to activate Statistic Group as under:
    --> Item category (Configuration)
    --> Sales document type (Configuration)
    --> Customer (Maintain in Master data)
    --> Material (Maintain in Master data)
    When you generate statistics in the logistics information system, the system uses the combination of specified statistics groups to determine the appropriate update sequence. The update sequence in turn determines for exactly which fields the statistics are generated.
    Configuration:
    IMG --> Logistics Information System (LIS) --> Logistics Data Warehouse --> Updating --> Updating Control --> Settings: Sales --> Statistics Groups -->
    1. Maintain Statistics Groups for Customers
    2. Maintain Statistics Groups for Material
    3. Maintain Statistics Groups for Sales Documents
    4. Assign Statistics Groups for Each Sales Document Type
    5. Assign Statistics Groups for each Sales Document Item Type .....
    All Standard Reports which are available are as under:
    SAP Easy Access: Information Systems -> Logistics -> Sales and distribution ->
    1. Customer -> Incoming orders / Returns / Sales / Credit memos / Sales activities / Customer master / Conditions / Credit Master Sheet
    2. Material -> Incoming orders / Returns / Sales / Credit memos / Material master / ...
    3. Sales organization -> Sales organization / Sales office / Sales employee
    4. Shipping point -> Deliveries / Returns
    5. SD documents -> Orders / Deliveries / Billing documents ...
    & so on.
    Regards,
    Rajesh banka

  • Compare two dates in a report

    Hi,
    I would like to compare two dates on a report.
    I would like to compare the opportunity created date and the opportunity modified date. I can't use this formula CASE WHEN Opportunity."Last Modified" = Opportunity."Created Date" then 1 else 0
    I think I have to use TIMESTAMPDIFF but I don't know which interval I have to put to analyze the entire date in this format 31/12/1999 16:49:08
    Thanks a lot for your help
    Regards,

    Hi !
    It depends on the interval you need to compare these dates. If you want to know the number of days between these dates, you'll have to use SQL_TSI_DAY as interval. If it's minutes, you'll need SQL_TSI_MINUTE...
    Here are the possible intervals :
    *SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, or
    SQL_TSI_YEAR*
    Hope this will help, feel free to ask more !
    Max

  • 0 fiscper3 (posting period)and 0fiscyear (fiscal year) in bw report

    Hi I need a quick help, please resolve my issue in step by step. Report is required to display the 0 fiscper3 (posting period)and 0fiscyear (fiscal year) in bw report. I have a 0fiscper Fiscal Yr / Period in my datasource and infosource but not 0fiscper3 (posting period)and 0fiscyear (fiscal year). Can any body help me how to add the abap code to convert the 0fiscper Fiscal Yr / Period to display 0fiscper3 (posting period)and 0fiscyear (fiscal year in report or how to add by abap code 0fiscper3 (posting period)and 0fiscyear (fiscal year)in datasource. User will select the value of 0FISCYEAR
    Fiscal year during the execution of report. please help
    will reward all points.
    thanks
    soniya kapoor

    In de update rules from infosource to datatarget you fill the rules like this:
    For 0FISCYEAR:
      result = comm_structure-fiscper(4).
    For 0FISPER3
      result = comm_structure-fiscper+4(3).
    Note that this can also be done by using formula's. If you can't ABAP you may prefer to use formula's.

  • Half yearly vs Quarterly Reports in Answers

    Hi,
    I have a requirement from customer, where they want the report to be shown for quarter by default.They want to have a drop down where they select "half year" and the report need to be displayed for half year.
    These two report differ only by the "filters" i.e year =<quarter> or year =<half year> .IS there any way this requirement can be achieved in a single report??? please suggest if any compound view feature can be helpful

    I solved this requirement by creating a dropdown of the reports.

  • Last year sales volume report

    Hi BW Expert,
    I have sales report  the  current primary volume is the CKF dispalying and i have problem last year primary volume is not dispalying . i tried using offset -1(fiscal year period) the values are not diplaying .Can any one suggest how to dispaly the last year values.
    Regards
    sivaraju

    Hi,
    As you have mentioned in post, there is problem with pervious year sales volume report. Are you looking data for entire year, in that case you should offset for fiscal year -1.
    Also you are looking only for one period of pervious year, offset with -12 not with -1. If those restrictions are correct, check if you have fiscal year variant included in query. For offset to work proper you should have the fiscal year variant field in the query.
    only then offset will work fine.
    Hope this helps
    Regards
    Akhan

  • How can I compare two periods in a report based on parameters

    Hi all,
    I'm wondering how can I create a matrix report which compares the sales of two periods. These periods are variable and coming from the parameter section that the user is using. For example, I have got the following table "Sales". Columns are:
    ID (not visible in report, can be used to lookup)
    Country
    Customer
    Year
    Quarter
    Month
    Gross sales
    The output that I would like to get is the following
    Parameter period 1: 2013 Q1
    Parameter period 2: 2013 Q3
    The report should look something like this:
                                          2013 Q1         
    2013 Q3
    USA                Microsoft         50000          75000
    So in the third column you'll see the sales based on parameter period 1, and the fourth column shows the sales based on parameter period 2.
    Thanks for the help!

    Just to be sure I understand...
    You have 1 primary dataset that returns records that will be displayed in a tablix in your report. The data will include sales information records from various years, quarters, etc. You want your report user to be able to select 2 sets of data for comparison
    based on quarter. Is this correct?
    To do this, start by adding a Matrix to the report. Set the Column Group to group on the expression:
    =CStr(Fields!Year.Value)+" "+Fields!Quarter.Value
    Set this same formula as the group header. Now Set the existing Row Group to group on Customer. Add a parent group above this Row Group and group on Country. In the detail cell set the value to:
    =Sum(Fields!GrossSales.Value)
    You will also need to access the tablix properties and set a filter as follows:
    Expression: =CStr(Fields!Year.Value)+" "+Fields!Quarter.Value
    Operator: In
    Value: @Quarters
    For this filter to work, you will need to create the @Quarters parameter as follows:
    On General tab:
    Name - Quarters
    Prompt - Select Quarters to Compare
    Data type - Text
    Allow multiple values - Checked
    Visible - Selected
    Available Values:
    Get values from query - Selected
    Dataset - dsQuarters
    Value field - YearQuarter
    Label field - YearQuarter
    Default Values:
    No default value - Selected
    Advanced: Leave at default settings
    For the parameter to work you need to create the dsQuarters dataset. This dataset needs to return a single column of distinct values for Year + " " + Quarter based on the same query that you use for your primary dataset. Add the distinct keyword (if using
    TSql) or equivelent and eliminate all of the unnecessary columns. Set it to return Year + " " + Quarter AS YearQuarter.
    Let me know if you have questions or if I missed something.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • Year to Date reports using Prompts

    Hi.
    I'm trying to build a report that will show results of sales compared to Annual targets. All those fields are fields directly at the opportunity level (amount and targets). I also need to put a prompt to select dates from and to, for the Opportunity Close date. I've used Variables for this, and am comparing throuhg two filters "Opportunity.Close Date greater than pvCloseDateFrom" and "Opportunity.Close Date lower than pvCloseDateTo". I'm also presenting the % Achievment, which is the % of Total Sales compared to the Target field.
    So far the report is simple
    User - Total Amount of Sales - Target FIeld - % Realized.
    The difficulty I'm facing concern the next set of columns in the report : I also need to present the Year to Date Target that is represented by the number of days between the two dates prompted (for instance if I prompt 01/01/2010 and 31/03/2010 needs to show 25% of the total target) along with the % of SAles compared to this new target calculated field.
    I'm having issues with the TIMESTAMPDIFF function through the Presentation Variables as it either tells that the type is not correct even if I'm trying to use the CAST function or it discard part of the string when I'm trying to rebuilt the date as a timestamp : in my configuration date are presented D/M/YYYY where my timestamp function expects DDDD-MM-DD HH-MI-SS.
    Is there anyone who could have an example of such calculations in a report based on dates and duration ?
    Thanks in advance for your help !!
    Olivier

    Dear Adam,
    For Year to Date , We have created a Customer Exit , For working , Create a Variable for 0calday and populate that with from and to value ...to value would be Sy-datum and From value is year starting date. Hope it helps..
    Thanks,
    Krish

  • Compare two year column

    Hi to all,
    I'm new at Crystal and I have a question.
    I have a source table that have the following layout:
    NAME       DATE      SALES_VALUE
    aaaaa      Jan09           1000
    bbbbb      Feb09           1111
    ccccc      Mar09           1010
    aaaaa      Jan10            1200
    I want to create a report that compares the same month on diferent years like the following:
    NAME       JAN09      JAN10
    Of course, the month is not fixed, but it will be a parameter defined by the user...
    Can anyone help me?
    Thanks,
    Luis

    You could create a formula, and group off of it.
    day()&" "& month()
    If you go to details section and check Format with Multiple Columns
    you will see a layout tab pop up.
    click on it, select the proper width
    and across then down
    then you will get your two columns.
    Something like this
    NAME     DATE     SALES_VALUE                 NAME     DATE     SALES_VALUE
    aaaaa     01/01/2010      1,000.00                           aaaaa           01/01/2011      1,507.50
    aaaaa     02/01/2010      1,952.50                          aaaaa     02/01/2011      2,397.50
    bbbbb     01/10/2010      1,240.50                           ccccc     01/10/2011      1,908.00
    bbbbb     02/10/2010      2,353.00            ccccc     02/10/2011      2,798.00

  • How to get Current month last year sale in report

    HI,
              I would like to compare the sale value of a  month for any year.
    ie sale of the march month for this year ,previous year and a year before ..like that
    at least for two years..ie current and prvious year.
    how can i get it done in query?
    thnx

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

  • How to display the week of the year in a report

    Hi,
    I am doing a report, that needs to break down the information, according to month and then week.
    The week of the year isn't stored anywhere in the database, so i guess it would have to be calculated.
    How would i go about doing this in report?

    hi, yes thats what i mean.
    So if i run my report for 01-feb-2008 to 30-march-2008
    it needs to group the data according to weeks.
    eg. week5 (data)
    week6 (data)
    etc....
    i got this code: select to_char(sysdate, 'IW') from dual;
    will it allow me to do this?

  • Comparative calculation in a monthly report

    Hi all,
    I have a report for quantity for 3 months(billing date base) .
    EX:                      01.01.2010 to 31.01.2010             01.02.2010-28.02.2010                        01.03.2010-31.03.2010          
               Cust1               Qty 50                                               60                                                                    40
    Like that I have Quantities for 3 months. Now my question is how to calculate the added quantity of the next month compared to current month.
    For suppose if I want added quantity of February, I can see  that there is 10Quantity increased, but how to write the formula for this.
    And at the same time how to write a formula for  the decreased quantity if we need to see the quantity of March.
    Here for Billing date I have taken 3 variables with offset values(for information).
    Like that if I run a report for 6months I want a formula which calculates the increased as well decreased quantities for all 6months.
    Please answer
    Thx

    Hi,
    In Report
      Jan Qty-- Feb Qty-- +/- with last month-March Qty +/- with last month  like that u re required report
    If it is the case
    Qty u are restricting with current month and offset -1 that means last month ure getting as two RKF
    then that 2 rKF can use in one CKF
    RKF current month-- RKF last month
    we will get the vale either +/- in different column.
    Thanks & Regrds,
    Sathish

  • Line Chart to Compare Current Year vs Last Year

    I am on BI 7 SP9. I need to create a line chart that shows 2 lines to compare  revenue for the current year against last year. The first line should show the revenue for the current year. The second line should show the revenue for last year. In my BEx query, I have the fiscal period values in the row and the revenue key figure in the column. Questions:
    1. How can I show 2 lines in the chart to compare revenue for the current year vs last year?
    2. There are 2 variables for the fiscal period - one for current year and one for last year. The user can enter any value range in the fiscal period variables at query runtime, but the fiscal periods for each of the 2 years must be the same. This means the number of fiscal periods that appear in the query result rows will vary (e.g.. 3 periods for a quarter or 12 periods for a full year). The user has to enter the same fiscal periods for the current year and last year variables. How can I determine the fiscal period values to plot in the line chart for the current year and then last year when the number of rows in the query results will fluctuate?
    The legend at the bottom of the chart should show JAN, FEB, MAR...DEC instead of the fiscal period values like 001/2007, 002/2007. Is there an exit I have to change to get this to work?
    Thanks for any help you can give!

    You can do it in multiple ways
    1.
    SELECT COALESCE(t1.Company,t2.Company) AS Company,
    COALESCE(t1.Sales2015,0) AS CurrentYearSales,
    COALESCE(t2.Sales2014,0) AS PriorYearSales
    FROM Sales2015 t1
    FULL JOIN Sales2014 t2
    On t2.Company = t1.Company
    2.
    SELECT Company,
    MAX(CASE WHEN YearVal = 2015 THEN Sales ELSE 0 END) AS CurrentYearSales,
    MAX(CASE WHEN YearVal = 2014 THEN Sales ELSE 0 END) AS PriorYearSales
    FROM
    SELECT Company,Sales2015 AS Sales,2015 AS YearVal
    FROM Sales2015
    UNION ALL
    SELECT Company,Sales2014 AS Sales,2014
    FROM Sales2014
    )t
    GROUP BY Company
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

Maybe you are looking for

  • Best Practice regarding using and implementing the pref.txt file

    Hi All, I would like to start a post regarding what is Best Practice in using and implementing the pref.txt file. We have reached a stage where we are about to go live with Discoverer Viewer, and I am interested to know what others have encountered o

  • Help with Imports

    Ok my problem is hard to explain but I'll do my best. My iTunes is brand new. Yesterday I downloaded and installed it. As soon as I opened the program it started moving my music from Windows Media Player onto iTunes. This was all well and good but th

  • XMLStreamReaderBase tries to create a QName with a null namespace prefix

    Given the following xml: <foo> <bar type="value"/> </foo> Calling getAttributeName(index) while on the 'bar' element will cause an IllegalArgumentException as XMLStreamReaderBase tries to create a javax.xml.namespace.QName with a null prefix instead

  • Reinstall Windows 7 Home Premium x64 on Satellite R850

    I made recovery discs ( 5 DVD`s ). My question : must I reinstall operating system from recovery discs or I can install trial Windows 7 Home Premium and activated with my serial number?

  • Backed up, what do i do now?

    Intel Core Duo 15 My husband threw all his documents in the trash and emptied it. I told him to stop using the computer immediately. He was using the program called Backup that was from the dot mac service. There is a full backup from 2007, and incre