Sales Last Year

Hi,
I need to calculate the sales last year.
I have a month and year.
And measure_sales
for example, i have this sales:
Year Month measure_sales
2011 1 14,40
2011 2 23,40
2011 3 5,40
2011 4 44,40
2011 5 38,40
2011 6 19,40
2011 7 3,40
2011 8 60,40
2011 9 40,40
2011 10 30,40
2011 11 56,40
2011 12 60,40
2012 1 40,40
2012 2 30,40
2012 3 56,40
2012 4 60,40
Now, i show the sales of 2012 and the last year
Year Month measure_sales last_year??
2012 1 40,40 14,40
2012 2 30,40 23,40
2012 3 56,40 5,40
2012 4 60,40 44,40
Thanks !!

Benito Camelas wrote:
Hi,
I need to calculate the sales last year.
I have a month and year.
And measure_sales
for example, i have this sales:
Year Month measure_sales
2011 1 14,40
2011 2 23,40
2011 3 5,40
2011 4 44,40
2011 5 38,40
2011 6 19,40
2011 7 3,40
2011 8 60,40
2011 9 40,40
2011 10 30,40
2011 11 56,40
2011 12 60,40
2012 1 40,40
2012 2 30,40
2012 3 56,40
2012 4 60,40
Now, i show the sales of 2012 and the last year
Year Month measure_sales last_year??
2012 1 40,40 14,40
2012 2 30,40 23,40
2012 3 56,40 5,40
2012 4 60,40 44,40
Thanks !!Do this:
1) For your report, you need 4 columns: Year, Month, two instances of your measure_sales column.
2) Click on the fx button of the first measure_sales column.
3) Click on the Filter button. Navigate to your Year column in the left pane of your workspace.
4) When the filter window appears (automatically after you select the Year column), set it equal to 2012.
5) Click "OK." This column column will represents sales when the year is 2012.
6) Do the same thing for the second instance of your measure_sales column, except this time, set the year = 2012.
This will give you your report of this year and last year's sales.
Test this to see that it works.
Your next question will be, "How do it make it generic so the user can choose what "this year" means?
For that, build a dashboard prompt on Year and set it equal to a presentation variable called pv_year.
Now go back to your two columns and replace 2012 with @{pv_year} and 2011 with @{pv_year}-1
That's it.

Similar Messages

  • Line Chart - Current Year Sales, Current year Returns, Last year Sales, Last Year Returns

    We have a report that summarises monthly sales & credits for 2 years in a group footer.   The footer is a sum of a formula in the detail section that calculates the monthly sales at the Item code level
    Item 1
    Group Footer 1     July     Aug     Sept     Oct          
    Sales Last Yr     @July_LY_Sales @Aug_LY_Sales     @Sep_LY_Sales  @Oct_LY_Sales          
    Credits Last Yr @July_LY_Credits @Aug_LY_Cred     @Sep_LY_Cred   @Oct_LY_Cred          
    Sales This Yr @July_CY_Sales @Aug_CY_Sales     @Sept_CY_Sales @Oct_CY_Sales          
    Credits This Yr @July_CY_Cred @Aug_CY_Cred     @Sep_CY_Cred @Oct_CY_Cred          
    <Curr Yr Graph1>
    <Last Year Graph2>
    Item 2
    Group Footer 1     July         Aug           Sept                               Oct          
    Sales Last Yr  @July_LY_Sales   @Aug_LY_Sales @Sep_LY_Sales @Oct_LY_Sales          
    Credits Last Yr @July_LY_Cred  @Aug_LY_Cred     @Sep_LY_Cred @Oct_LY_Cred          
    Sales This Yr   @July_CY_Sales  @Aug_CY_Sales     @Sept_CY_Sales @Oct_CY_Sales          
    Credits This Yr    @July_CY_Cred   @Aug_CY_Cred     @Sep_CY_Cred @Oct_CY_Cred          
    <Curr Yr Graph1>
    <Last Year Graph2>
    In the footer under the data, we want a 4 line graph (or 2 x 2 line graphs for this year & last year).  One line for sales for the current 12 months, and with it, a line plotting the credits, so as to see the trend over that year.  And then we want a line graphing the previous years sales and a line graphing the previous year credits for the 12 months. 
    On the data tab in chart expert, we selected the Place chart for each SHDOC.ITEM (Item number) in the footer and this is positioning correctly.  We have tried selecting "On change of shdoc.item and we have also tried For each record.  We selected on change of shdoc.item to generate the graph for each item.  We then added the 12 formula for the current year in the Show Value panel  
    In the show value panel we tried using the detail formula, the Report Area: Sum of <formula> and the Group 1: Sum Formula.  They all display as @July or @Aug which is a dependent formula used to identify the month
    We have added the above formula for each month and each value, but we can't work out how to group the monthly data into the 4 series of 4 lines (1 colour each) - Current Year Sales, Current Year Returns, Last Year Sales, Last Year Returns for the charting.  We have tried to create a graph with only 1 set of monthly data (viz, just 12 months current year sales) But no matter what options we take, we seem to get 12 line chart representing each month rather than 1 line representing 12 months.
    Can someone point us in the right direction?

    Please re-post if this is still an issue but search forums first, lots of chart questions have been answered.

  • Sales Summary - Compare same weekday sales last year.

    Post Author: geoffh
    CA Forum: Formula
    I have a table storing invoices going back several years. I wish to calculate the total sales for yesterdays date, & compare it with total sales for the same weekday in the previous year. For example if it is Tuesday today, I need to calculate Mondays total sales (yesterday) & also Mondays total sales for the same week period last year.
    Date fields I have available are 'history.date_invoiced' (invoice date) , history.week_invoiced , history_year.invoiced. Sales values are history.sell_account & history.sell_cash.
    I'm new to crystal.......Using V 11.0.0.1282 . Any help would be greatly appreciated.

    Post Author: yangster
    CA Forum: Formula
    create a formula with the following informationnumbervar weeknumber_curr_year := datepart("ww", dateadd("d", -1, ));numbervar weekdaynumber_curr_year := datepart("d", , 1);  //assuming sunday is the start date of the week, change to 2 if monday isthose 2 variables will tell you the current week number and what day of the week you are after for the current yearnumbervar last_year := dateadd("yyyy", -1, currentdate);if year() = last_year and datepart("ww", ) = weeknumber_curr_year anddatepart("d", , 1) = weekdaynumber_curr_year then amt_field else 0put that in the details section and create a summary of the formula and you should have the total sum of sales for exactly the same week and day of week one year prior to yesterdaymaybe kai has a more simplified solution but that's what comes off the top of my head

  • A simple query to show sales versus last year on daily basis/

    Hi guys,
    I want to build a simple query with day (1,2,3,4,5,6) on the rows and "sales current year" and "sales last year"
    on the columns.
    I have only 0CALDAY in my cube.
    How can I have on the rows the day in stead of the full date?
    I would like to see in the sames row sales current year and sales last year.
    Thanks
    Shlomi

    HI Shlomi
    Create a virtual characteristic in your infoprovider that can calculate the day from calendar Day. In ZXRSRZZZ while adding code for this virtual characteristic use the function module DATE_COMPUTE_DAY to compute the day for every calendar day.
    For calculating Sales Current year, create a restricted ky figure with Sales as the key figure. Add 0CalDay to this RKF and create a variable for this infoobject(Eg: ZCURYEAR) that will receive input from the user for the range of dates eg: 08/16/2009 - 08/22/2009.
    For Sales Prior year, create another restricted key figure with Sales. Add 0CalDay to this RKF and add a customer exit variable. In the Customer exit code use the ZCURYEAR variable and offset it to prior year in both the upper and lower limits. This should work.
    I hope this helps.
    Thanks.

  • YTD , Last year YTD help needed in OBIEE 11g

    Hi all,
    I have a report which looks this way
    Banner Name
    *Sales YTD*
    *Sales Last year YTD*
    YTD values are based on actual date of running report.
    *so ex: the report is ran on 10-feb-2013, the Sales YTD will be from
    01-Jan-2013 till 10-Feb-2013.*
    * Sales Last year YTD will be 01-Jan-2012 till 10-feb-2012.*
    I have achieved Sales YTD with my Time dimension.
    My time dimension has the data for Last year , year ago date!
    Can you please help me out on how to proceed for the Last year YTD
    calculation?
    Its helpful to share any syntax..
    Regards
    Kumar

    Hi,,
    you can use Todate Function.
    Take a Look @ this http://mkashu.blogspot.in/2013/08/obiee-model-time-series-in-obiee.html
    Regards,
    VG

  • ^How to show difference between sales in year 2009 and 2010

    Hi experts,
    I am facing a problem in a BEx Query. I have to show the difference between the sales of two years. Let me be more specific..
    I only have one keyfigure sales and only one characteristic year and I need the column difference.
    year      sales      difference
    2009      5000      -
    2010      8000      3000
    2011      9000      1000
    Please can anybody explain me how to get this.
    Many thanks in advance
    Peter

    Hi Peter
    There are various ways of getting the result you are going for.
    1. If you are 100% locked to the way the data has to be shown - you can use CELLS.
    a. start of making a strukture on year getting the years you need (in rows)
    b. generate a structure with 1 the key figure "sales" and second a formula which equals zero
    c. press Cells in your menubar and give all the combination of Sales and years a cell reference.
    d. Create formulas in the combination of year/Formula=0 and just make the formula this years sales - last years sales.
    This is a lot like Excel but also is'nt very handy for navigating and hence not a solution I normally would recomend
    If you are not on the other hand restricted to the way it has to look I would generate 3 columns with restricted key figures.
    1 with filter on Fiscal Year (0FISCYEAR) taking Current year and key figure sales
    2 With filter on Fiscal Year taking Current year and an offset of -1 and key figure sales
    3 Same and offset -2
    Last I would make 2 formulas giving me the differences.
    But as mentioned there are many ways of achieving your goal - maybe someone will have a better way
    Best Regards
    Xavier

  • How to calculate the sales in the last month of last year

    Hi all,
    I have a requirement need to implement ,
    the report has three columns,
    MONTH----SALES----SALES2
    201201----10------------100
    201202----20------------100
    201203----30------------100
    201204----40------------100
    201205----50------------100
    The Sales2 is the sales of last month of last year, that is sales in 201112, value is 100.
    How to realize this requirement ?
    thank you in advance!!!

    sorry,
    I think you maybe not understand my requirement.
    What I want to implement as follow,
    MONTH----SALES----SALES2
    201201----10------------100 (This is 201112's Sales)
    201202----20------------100 (This is 201112's Sales)
    201203----30------------100 (This is 201112's Sales)
    201204----40------------100 (This is 201112's Sales)
    201205----50------------100 (This is 201112's Sales)
    201206----60------------100 (This is 201112's Sales)
    If I set SALES2 =AGO(SALES,MONTH, <number of period>)
    how can I set <number of period> ?
    201201 should mapping to 201112
    201202 also mapping to 201112
    201203 also mapping to 201112
    201204 also mapping to 201112
    201205 also mapping to 201112
    201206 also mapping to 201112

  • How to show current year and last year sales in a WEBI Report

    Hi Guys
    How can show current YEar Sales in one column and Last YEar Sales in the other column based on a user prompt for the Current YEar Column.
    For Example is user enter 2010 for Year how can i show a Column for Sales-2010 and Sales 2009.
    Thanks

    If you can modify your Universe add an object named New Object Last Year whose SQL is:( yourTableName.Year + 1)
    Then in WebI create two distinct queries in your query Pane. In the first one you could do this:
    Query 1:
    objects: Year, Sales ... etc.
    filters:   Year Equal to '1. Prompt Year'
    Query 2:
    objects: Year, Sales ... etc.
    filters:    New Object Last Year Equal to '1.Prompt Year'
    Then in your report you can drag each object on their respective columns.
    If you don't want to use two distinct queries, use one like this:
    Query 1:
    objects: Year, Sales ... etc.
    filters:        Year Equal to '1. Prompt Year'
                 Or
                      New Object Last Year Equal to '1.Prompt Year'
    Edited by: PadawanGirl on Jun 23, 2011 6:28 PM

  • How to load member for "sales same date last year"?

    I need to load a member in Measures named "PriorYrSales" with "Sales" for the same date last year as today's date. Thus, retrieving "PriorYrSales" for 2/10/2002 would return the sales amount for 2/10/2001. Since days roll-up to months, quarters, years, it would be easy to determine how we're doing compared to the same time last year.Data is loaded each day for a date range from the current date and the preceding x days. Substitution variables are available for the beginning and ending date and the same dates for last year.For example: Data is loaded from beginning date of 2/01/2002 through ending date of 2/10/2002.The prior year date variables contain 2/01/2001 and 2/10/2001.The time period dimension is as follows:FY01->Jan2001-->01012001 (Alias: 1/01/2001)-->01022001 (Alias: 1/02/2001)-->all the dates in Jan->Feb2001-->02012001 (Alias: 2/01/2001)-->02022001 (Alias: 2/02/2001)-->all the dates in Febetc.FY02->Jan2002-->01012002 (Alias: 1/01/2002)-->01022002 (Alias: 1/02/2002)-->all the dates in Jan->Feb2002-->02012002 (Alias: 2/01/2002) -->02022002 (Alias: 2/01/2002)-->all the dates in Febetc.Thanks your any and all suggestions.Phil

    Perhaps I wasn't clear in the first post. The intent is to easily compare sales for a current date/period to the same date/period last year. Neither Excel nor Analyzer provide a method that I'm aware of to retrieve data as follows:-------------------------------------Period Sales PriorYrSales Diff4/15/2002 1,000 900 100-------------------------------------(900 is sales for 4/15/2001)(100 is the calculated difference.)Nor can I do this:-------------------------------------Period Sales Period Sales Diff4/15/2002 1,000 4/15/2001 900 100-------------------------------------What Excel and Analyzer do allow is:-------------------------------------Period Sales 4/15/2002 1,0004/15/2001 900-------------------------------------I readily acknowledge that the data is redundant but I can't think of another option that will allow Excel and Analyzer to easily retrieve the values for comparison. If the PriorYrSales member can be loaded then the users can compare years, quarters, months and days quite easily.My challenge is knowing how use a calc script to derive prior year dates that correspond to current year dates. Something like:PriorYrSales->04152002 = Sales->04152001I've considered arrays but I've never used them and the documentation is not helpful enough for me.Thanks for your response.Phil

  • Last Year Sales Report

    I have a requirement where say user selects year and months by prompts eg. 2008 jan and 2008 feb. It should also give me sales for last year and should be arranged as rows.
    2008 Jan Sales
    2008 Feb Sales
    2007 Jan Sales
    2007 Feb Sales
    How to go about it?
    Thanks

    You would need to expose another column (you can hide it, of course) that contains the month number (monthnum) equivalent (1 - 12) of the month name (Jan - Dec). Set primary sorting (1) to the year in descending order and secondary sorting (2) to the monthnum column in ascending order.
    As for getting "last year's" data from the prompt, say you have a prompt called "Year." Then you would create two "year" filters, on the Year column, as follows:
    "column name".year = @{Year}
    OR
    "column name".year = @{Year}-1
    This will pull both the "prompt year" and the year before.

  • How to get YTD sale for Last year In OBIEE 11g

    Hi All,
    I have a fact table for Sale_Amt with doc_date wise details. It is connected to Simple time_dimension table based on Date_ID(Number) field. The time_DIm Hierarchy is set on Year, Quarter, Month fields of the time_dimension table.
    One of my reporting requirement is to show show YTD sales and Last Years YTD sales.
    e.g, If user select 23 Jul 2013 as the date parameter, I need to show 1-Apr-2013 till 23 Jul 2013 Sales in YTD column and 1-Apr-2012 till 23 Jul 2012 Sales in Year_Ago_YTD column. I am able to get YTD sales but unable to derive at Year_Ago_YTD sales figures.
    Finacial Year Start from 1st April till 31 March.
    Any Help on this will be appriciated.
    Thanks.
    Narendra Shetty.

    Narendra,
        You can make use of the below two functions to get the year ago dates. You can replace current_date with a presentation variable that stores the date parameter that user selected.
    TimestampAdd(SQL_TSI_YEAR,-1,TIMESTAMPADD(SQL_TSI_MONTH, 3,TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) - It will display previous year's first day of fiscal year (since I passed current_date, it gives you 1st april 2012)
    and
    TimestampAdd(SQL_TSI_YEAR,-1,current_date) - Same Day Last year
    Pls mark correct/helpful.

  • Problem with bex query listing sales "this month" and "same month last year

    Hi,
    I've created a query in BW BEx, where I have a mandatory variable for 0calmonth, and I list 0material and sales (in volume, liter). And I have a restricted key figure giving me sales (volume in liter) restricted with 0calmonth = variable - 12, to give me the sale for the same month the user select, previous year.
    This seems to be working, the sum is correct, but when adding up the number for the sales in the month previous year, the numbers does not fit the sum in the end.
    I think the report only lists materials with sales the month selected in the variable, if a material has not been sold that month, but in the same month last year, it's not listed in the reports, but it's added in the sum in the end.
    Example.
    We have three records like this:
    material - calmonth - volume
    101 - 01.2010 - 5
    101 - 01.2011 - 8
    201 - 01.2010 - 7
    The report will give the following (calmonth variable = 01.2011)
    Material - volume this month - volume same month last year
    101 - 8 - 5
    Sum 8 - 12
    Any way to solve this issue? We noticed because we run BO - Webi on top of the BEx query, and BO sum's the values per material, and in webi the report would give us the sum 8 and 5.
    Any input is appreciated.
    Regards,
    Øystein

    Hi,
    thanks for your reply.
    The error is that the report only seems to list materials that has been sold "this month", and if the same material was sold the same month last year, it will also list the volume for this.
    But if the material is only sold in the same month last year, it's not listed in the report, but it's calculated into the sum at the end.
    The report is listing material, which is why the error presents itself, as you said
    Getting 8 minus 12 is correct unless you drill down by material. In that case, it should be 8 minus 5 and 0 minus 7.
    The row with 0 - 7 is not shown, and my guess is that the report will only list materials that has sales this month (which has been selected in the variable)
    Regards,
    Øystein
    Edited by: Oystein Gundersen on Mar 21, 2011 4:36 PM

  • How to compare this week with last years week sales ?

    Hi all,
    I have a table called Sales with two columns  Date and UnitsSold
    Date is of type smalldatetime   and will have the date of the sales
    while UnitsSold is type int and will have the number of units sold
    I need to write a stored procedure that will compare between a week's sales from last year with a week sales from this year and show the percent in sales difference
    Thanks

    DECLARE @thisYearThisWeekStart DATETIME = DATEADD(DAY,1-DATEPART(weekday,'2014-01-01'),DATEADD(WEEK,DATEPART(WEEK,GETDATE())-1,'2014-01-01'))
    DECLARE @thisYearThisWeekEnd DATETIME = DATEADD(DAY,0-DATEPART(weekday,'2014-01-01'),DATEADD(WEEK,DATEPART(WEEK,GETDATE()),'2014-01-01'))
    DECLARE @lastYearThisWeekStart DATETIME = DATEADD(DAY,1-DATEPART(weekday,'2013-01-01'),DATEADD(WEEK,DATEPART(WEEK,GETDATE())-1,'2013-01-01'))
    DECLARE @lastYearThisWeekEnd DATETIME = DATEADD(DAY,0-DATEPART(weekday,'2013-01-01'),DATEADD(WEEK,DATEPART(WEEK,GETDATE()),'2013-01-01'))
    DECLARE @thisYear INT, @lastYear Int
    DECLARE @salesTable TABLE (date DATE, unitsSold INT)
    INSERT INTO @salesTable (date, unitsSold)
    VALUES
    ('2013-07-07',10),('2013-07-08',9),('2013-07-09',8),('2013-07-10',7),('2013-07-11',6),('2013-07-12',5),('2014-07-13',4),
    ('2014-07-06',12),('2014-07-07',13),('2014-07-08',14),('2014-07-09',15),('2014-07-10',16),('2014-07-11',17),('2014-07-12',18)
    SET @thisYear = (SELECT SUM(unitsSold) AS tUnitsSold FROM @salesTable WHERE date BETWEEN @thisYearThisWeekStart AND @thisYearThisWeekEnd)
    SET @lastYear = (SELECT SUM(unitsSold) AS tUnitsSold FROM @salesTable WHERE date BETWEEN @lastYearThisWeekStart AND @lastYearThisWeekEnd)
    SELECT @thisYear AS thisYear, @lastYear AS lastYear, CONVERT(float,ROUND(((@thisYear+.0)/@lastYear)*100,2))
    You should really use a calendar table.

  • Last year sales calculation in calculated column

    Hi everybody!
    Please help me to solve issue with last year sales calculation in calculated column. I have 'Fact' table with sales for every period in it and related table 'Time' with 1, 2, 3 'PeriodID' column for string MAT 2011, MAT 2012, MAT 2013.
    I know the solution for measure:
    =CALCULATE ( SUM(Fact[Sales]); FILTER (ALL ('Time'); 'Time'[PeriodID] = MAX(Time[PeriodID]) - 1))
    But for the purpose of my analysis I need to make a calculated column. What I want to see looks like this table:
    Product
    Period
    Sales
    SalesLY
    A
    MAT 2013
    17
    10
    B
    MAT 2013
    20
    23
    C
    MAT 2013
    45
    33
    D
    MAT 2013
    13
    16
    A
    MAT 2012
    10
    8
    B
    MAT 2012
    23
    31
    C
    MAT 2012
    33
    5
    D
    MAT 2012
    16
    22
    A
    MAT 2011
    8
    0
    B
    MAT 2011
    31
    0
    C
    MAT 2011
    5
    0
    D
    MAT 2011
    22
    0

    Thanks for the idea!
    It's an option. I slightly modified expression to make it more generic:
    =CALCULATE
          SUM (Fact[Sales]);
          FILTER (
                        Fact; Fact[Product] = EARLIER (Fact[Product]) && Fact[PeriodID] = (EARLIER(Fact[PeriodID]) -1)
    Where Fact[PeriodID] is calculated column with '=RELATED (Time[PeriodID])' formula. To my opinion this is more universal approach.
    But it has the cons. EARLIER is memory demanded function. In case of 32-bit OS or numerous nested EARLIER error might occur.
    Is there any alternative solution?

  • Last year sales - Urgent

    Hello Experts,
    I am trying to get a last year sales for a simple report which have year, sales. Please advise.
    Thanks,
    RC
    Edited by: user1146711 on Dec 14, 2011 9:06 AM

    1) Get three columns of your measure.
    2) In the first instance of your measure, click on the fx button and then the Filters button. On the left side pane select your Year column and set it equal to 2011. Click "OK." And this will be your measure for the current year. Call this column "Current Year Measure."
    3) In the second instance of your measure, click on the fx button and then the Filters button. On the left side pane select your Year column and set it equal to 2010. Click "OK." And this will be your measure for the previous year. Call this column "Previous Year Measure."
    4) In the third instance of your measure, click on the fx button and delete the contents. Then click on the Columns button and select Current Year Measure. (Note: OBIEE will display the SQL instead of the column name, but that's okay).) Type in the "minus sign," click on the Columns button and this time select "Previous Year Measure." Finally, add the "/" sign the asterisk (*) and then 100.0 This will then be your variance change from last year's measure to this year.
    5) On the data format of the last column, change the data format to "percentage" and you're done.

Maybe you are looking for