CURRENT YEAR PREVIOUS TWO MONTHS SALES+MDX

QUERY TO GET CURRENT YEAR LAST TWO MONTH SALES DYNAMICALLY IN MDX

assuming you are looking for data with the latest two months and taking adventure works DW 2008  as sample DB
try this
select [Measures].[Internet Sales Amount]
on 0,
 {Tail(nonempty(descendants([Date].[Calendar].[Calendar
Year],[Date].[Month of Year]))).item(0),
 Tail(nonempty(descendants([Date].[Calendar].[Calendar
Year],[Date].[Month of Year]))).item(0).prevmember} 
on 1
 from [Adventure Works]

Similar Messages

  • Current year Previous Year in Query

    Hi,
    I have to get the results of current year 12 months( 12 columns) previous year 12 month( 12 columns) in one report.
    Once the user gives the current year , how to automatically populate the previous year. The PY varaint can be used for all months of previous year.
    Any thoughts on this, please let me know.

    As venkat said , using offset is the best option, rather than jumping directly to custom exit variable.
    for e.g.
    you report display is
    net qty.............net qty
    current year......  previous year........
    bil1
    bil2
    so u intend to see the net quantity for current year and previous year.
    Bring net qty... in Columns in query designer.
    Now right click and hit Edit
    Now bring in time chara. that u wish to use and want to create variable for.................
    for e.g. say fiscal period....
    Now hit fiscal period with right click andhit  Restrict.
    Go for Interval variable if already exist or else create a new one.
    hit okey..
    now in query designer in columns copy ur net quantity
    now paste there again.
    in Second net quantity u can hit edit.
    now where fiscal period is there hit restrict
    in dialog box hit Select offset.
    As ur intention is for previous year, keep the offset value as -12
    also restrict fiscal year variant in selection.....
    hit okey
    test it...
    if this doesnot work
    then go for custom exit....

  • Parallel period for previous year using two months

    Dears,
    I have an issue, Parallel period is working just fine and returning values of last year same month values like this one
    SUM(MTD(ParallelPeriod([Time].[Month].[Month],1,[Time].[Month].CurrentMember)),[Measures].[Invoiced net weight])
    it works fine when I select 1 month in the slicer. But when I choose 2 or more months, it is not returning anything . i tried to use EXISTING    
    SUM(  EXISTING [Time].[Month].[Month].Members,(ParallelPeriod([Time].[Month].[Month],12,[Time].[Month].CurrentMember),[Measures].[Invoiced net weight]))   but the results returned in the grand total are for the whole year total.
    how can I precise to it that I only need the total of the selected months only ?
    Any help is really appreciated
    Regards,
    Georges

    Hi Paul
    Please refer to following inline answer:
    - How can I do asset posting for 2010 now ?
    A: first of all, you need to check if fiscal year 2010 in GL side is still open. If fiscal year 2010 in both GL and AA is open, then you can post AA transactions in 2010 as usual.
    - How can I do asste posting for 2011 as we didn't close 2010?
    A: if transactions happened in 2011, then you can post those AA transactions in 2011 as usual. No matter whether fiscal year 2010 is opened or not.
    Hope itu2019s helpful.
    George

  • So i have had my iPod Touch 4G about a year now, two months ago the home button 'broke' to my understanding. It is not 'stuck'' i can click it but this action provokes no response. Im unsure what to do now, as Apple's ingenious on-screen home button *****

    Please Help.

    Try:
    http://snapguide.com/guides/calibrate-your-home-button/?utm_expid=69945963-15
    fix for Home button
    iPhone Home Button Not Working or Unresponsive? Try This Fix
    - If you have iOS 5 and later you can turn on Assistive Touch it add the Home and other buttons to the iPods screen. Settings>General>Accessibility>Assistive Touch
    - If not under warranty Apple will exchange your iPod for a refurbished one for:
    Apple - Support - iPod - Repair pricing
    You can do it an an Apple store by:
    Apple Retail Store - Genius Bar
    or sent it in to Apple. See:
    Apple - Support - iPod - Service FAQ
    - There are third-party places like the following that will repair the Home button. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens

  • Current Year and Previous Year (derived) data comparison

    Scenario:
    Dimension Table for Date:
    -Current Year
    -Previous Year
    -and other date related fields
    Fact Table:
    -Sales (contains current year sales depending on the filter set)
    *Filter on Year
    Would anyone know how will I create a measure for Previous Year Sales?
    So that whenever my report shows the current year (for example: 2009) data of my sales, I can also have a column that would also display the previous year data and it will automatically know that it would display the previous year data of the Current year displayed in my report.
    Also, how to derive the percentage change of this 2 columns.
    Year: 2009
    Branch --- Current Year Sales (Sales from Fact table) 2009 --- Previous Year Sales 2008???
    I want to add the Current Year Sales And Percentage Change of Sales in the Business Model/Mapping Section. so that it would be available in the presentation layer of Oracle Answers.
    Thanks.
    Edited by: user12074468 on Oct 16, 2009 4:38 PM

    Use column filters. Click on the fx button on your Sales column. Click on the Filter button. Now go to the Time.Year column you have and click on it. When the filter window comes up, click on Advanced and convert the filter to SQL. Now insert the Current Year column so that you have Time.Year = "Current Year" Click "OK."
    Get another Sales column and put it in your workspace. Follow the above procedure except this time use th Previous Year column.
    Now you have two Fact columns, one that filters for the Current Year and one that filters for your Previous Year.
    Now for your variance, click on one more column and place it in your workspace. Click on the fx button. This time click on the "Column" button. You will see a list of your columns. From this, create the (Current Year)-(Previous Year)/(Previous Year)*100.00. In the Data Format tab, change the format to percentage.
    You also have the option of creating the above calculations in the BMM layer too.

  • SSRS Matrix report. Variance expression by Month. Need to compare month from prior year to current month of current year VS2010

    Please help.  I have a matrix report.  In the report I have row group  PO Type.  One the Column groups I have a parent group by Fiscal Year, and then a child group by Month.  When I run the report, I get two years of data back broken
    out by month.  Please see below.
    Now here is where I am getting stuck.  I need to take the variance between the current month of the current year, from the same month of the prior year.  So I need to show the difference between Oct , 2014 from Oct, 2013. November, 2014 from November
    2013... etc. etc.
    In the example below, how do I create a column or row showing the variance for Contracts for October 2014.  I need to take the contracts for October 2014 which is 3 and subtract that from October 2013 which is 8.  Any suggestions? How do I do that
    for each month?  Then I need to do it for the quarter... then the year?  But I'll be happy if I can just get the month working first.
    Any help will be appreciated. 
    here is what my rdl file looks like.
    Here is what my report looks like when I render it.

    Hi Adrian_s2012,
    According to your description, you want to compare values for the month of current year with the month of prior year and get the variance. Right?
    In Reporting Services, we don't have any function to get this "Year to Year" Growth. In this scenario, if you data source is a cube, we suggest you use Analysis Services to achieve your requirement. If this data source is just from database, it will be hardly
    to calculate the variance because we need to compare the values within every two different column group and matrix generate adjacent columns one by one. Even we make it by using custom, every time executing the long code when generating result
    in a cell will reduce a lot of performance, we really don't suggest to do that in SSRS. Here is a thread with much easier requirement, please take a reference of that:
    http://social.msdn.microsoft.com/Forums/office/en-US/842e2dcb-d949-4297-9d91-eac989692cb5/difference-between-the-grouped-column?forum=sqlreportingservices
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Current Year and current month?simple question

    How can i get four Digit current Year and two digit current month. So if is march it should get me as 03 and the Year as 2002. Please do help me, is a simple question isn't it ?. Thanks for your earliest response.
    Thank you.

    i have a directory structre of the format
    REPTS2000209/E200209-98000001
    in which 2002 is current YEAR
    09 is current month
    and 9800001 is the code i would submit(list box) from a form
    so what i need is a program that can generate the above path and open that particular PDF file
    so basically E200209-98000001.pdf is the PDF file.
    i am submitting it from JSP page. PLEASE HELP ME how can i program.

  • How to get previous 2 months from current date in a dropdown?

    Hello Experts ,
                           In the application which I am developing, there is a requirement wherein , I want to Populate current month and previous two month in a drop down depending upon today's date. please help.
    Thanks & Regards,
    Pratbha Shukla

    The internal format for dates is yyyymmdd.  Therefore you can just grab the month value from the date:
    data lv_month type FCMNR.
    lv_month = lv_date+4(2).
    Just subtract from the month to get the two previous.
    data lv_previous1 type FCMNR.
    data lv_previous2 type FCMNR.
    if lv_month = 1.
    lv_previous1 = '12'.
    else.
    lv_previous1 - lv_month - 1.
    endif.
    if lv_previous1 = 1.
    lv_previous2 = '12'.
    else.
    lv_previous2 - lv_previous1 - 1.
    endif.
    Then do your lookup for the month name by reading the table returned from function module MONTH_NAMES_GET.

  • Monthly Sales report of a given Year

    Hi Experts,
    I have a requirement that User enters Fiscal year in Selection Prompt, based on the year, user wants monthly sales  like
    Jan-2010 | Feb-2010 | March 2010 | ..........| Dec-2010
    How can i get this?
    My report layout is like
    Vendor nbr     Vendor name  201001  201002   201003  201004     201005     201006     201007     201008     201009
         201010     201011     201012     Grand Total of sales revenue                                                                                                                             
    Thanks
    David

    Hi David,
    Can you add a column for Year?
    If Yes, then you Section the Year column in the report. This will make the months appear below this specific year.
    Then put the prompt for the Year. So when the user selects the year (eg: 2010), he will get all the months under the year 2010.
    Thanks
    Niranjan

  • Was went wrong my Ipad2 i had for 1year and two months on the LCD color look like wave

    Was went wrong my Ipad2 i had for 1 year and two months on the lcd have color on and blinking like wave?

    Close your iTunes,
    Go to command Prompt -
    (Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
    (Win XP SP2 & above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
    In the "Command Prompt" screen, type in
    netsh winsock reset
    Hit "ENTER" key
    Restart your computer.
    If you do get a prompt after restart windows to remap LSP, just click NO.
    Now launch your iTunes and see if it is working now.
    If you are still having these type of problems after trying the winsock reset, refer to this article to identify which software in your system is inserting LSP:
    iTunes 10.5 for Windows: May see performance issues and blank iTunes Store
    http://support.apple.com/kb/TS4123?viewlocale=en_US

  • MDX calculation based on date logic for the Jan 1 of current year through the 15th of the previous month

    Hello, 
    We need some help with an SSAS MDX query based on date logic. One of the problems is that I don't have access to the Cube but have been given a query example with the logic needed for the calculation. Here's the scenario; 
    The ETL process will run on the first Tuesday after the 15<sup>th</sup> of a given month. The Analysis Cube data queried should include the current year up to the end of the previous month. For example, on May 19<sup>th</sup>
    (the first Tuesday on or after the 15th) the query should include data from January 1<sup>st</sup> through April 30<sup>th</sup>.
    The 15<sup>th</sup> of the month is not part of the query, it is a factor in when the query is run. The query will always be in terms of complete months.
    SELECT
                    NON EMPTY { [Measures].[Revenue Amount],
                    [Measures].[Utilization],
                    [Measures].[AVG Revenue Rate],
                    [Measures].[Actual Hours] }
    ON
                    COLUMNS,
                    NON EMPTY { ([dimConsultant].[User Id TT].[User Id TT].ALLMEMBERS * [dimConsultant].[Full Name].[Full Name].ALLMEMBERS * [dimConsultant].[Employee
    Type].[Employee Type].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION,
                    MEMBER_UNIQUE_NAME
    ON
                    ROWS
    FROM
                    ( SELECT
    ( { [dimDate].[Week Date].[1/4/2015], [dimDate].[Week Date].[1/11/2015], [dimDate].[Week Date].[1/18/2015], [dimDate].[Week Date].[1/25/2015], [dimDate].[Week Date].[2/1/2015] } )
                    ON
                                    COLUMNS
                    FROM
                                    ( SELECT
    ( { [dimIsBillable].[Is Billable].&[True] } )
                                    ON
    COLUMNS
                                    FROM
    [SSASRBA]
    WHERE
                    ( [dimIsBillable].[Is Billable].&[True], [dimDate].[Week Date].CurrentMember ) CELL PROPERTIES VALUE,
                    BACK_COLOR,
                    FORE_COLOR,
                    FORMATTED_VALUE,
                    FORMAT_STRING,
                    FONT_NAME,
                    FONT_SIZE,
                    FONT_FLAGS

    Hi Hans,
    Thank you for your question.  
    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.  
    Thank you for your understanding and support. 
    Regards,
    Simon Hou
    TechNet Community Support

  • Current Month & Current Year Sales

    hi,
      How to get current month sales & previous month sales if sales measure is available for 2 years. I would like to display current month sales in one column and previous month sales in the second column and difference in the next column. For example, if i take this month as the current month, i have to display march sales in first column, february sales in second column and difference in third column. If you take a query designer, we restrict by month and display that month's value. Please advise.
    Thanks in advance.

    Hi
    create two variables in your WebI report containing if then clauses which restrict your key figures to the actual (or previous) month. Use those variables instead of your key figure directly.
    (NOTE: THIS IS PSEUDO CODE):
    if [0CALMONTH]=CurrentMonth then [KeyFigure1] else 0
    if [0CALMONTH]=PreviousMonth then [KeyFigure1] else 0
    The third column can contain the difference between the first two variables.
    Regards,
    Stratos

  • Sales report for current month and year a go month

    i could you please guide me builting report for current monthwise for current month and year a ago month
    report parameter month_year='06-2010'
    tables = sales and below are the table fields
    customer_id
    invoice_dt
    invoice_am
    thanks
    nhm

    Okay, Still you did not mention how you will pass value in report while generating.
    Anyway the query with UNION ALL will work. For Example.
    I am assuming that the parameter for date/month you will pass in range like 01-JUN-2010 to 30-JUN-2010
    SELECT customer_id, SUM(curr_value) curr_value, SUM(past_value) past_value
    FROM
    SELECT customer_id, NVL(SUM(invoice_amount),0) curr_value, 0 past_value
    FROM sales
    WHERE invoice_dt BETWEEN :P_FROM_DATE AND :P_TO_DATE  -- here P_FROM_DATE and P_TO_DATE will be the date range for current year as i showed above.
    AND  -- Any Condition goes here...
    GROUP BY customer_id
    UNION ALL
    SELECT customer_id, 0, NVL(SUM(invoice_amount),0)
    FROM sales
    WHERE invoice_dt BETWEEN ADD_MONTHS(:P_FROM_DATE,-12) AND ADD_MONTHS(:P_TO_DATE,-12) -- This add_months function for the previous year same month.
    AND -- Any condition goes here...
    GROUP BY customer_id
    GROUP BY customer_idNow using the above query you can design the tabular report as you showed the format.
    -Ammad
    Edited by: Ammad Ahmed on Jul 3, 2010 7:55 PM
    added GROUP BY

  • Compare month sales with previous year same month sales

    hi all.
    we need to compare given month of this year with same month of last year. we need to compare sales quantity and value.
    the query is on 0RT_C40 multiprovider. We have tried all options using 0Calmon, calday, fiscal year... but whenever we specify offset, we are not getting data. there is valid data for previous year.
    plz let us know what else to do? check with 0RT_C40.
    thanks in advance.
    regards: gaurave

    Gaurave,
    Are you selecting the time period in a selection in columns or rows, or are you selecting the time period in the Filter or Free Characteristic area.
    When you make the initial selection of say Period 11.2007 in the Free Characteristic area, and then within a selection but on an offset to derive 11.2006, the fact that you have made your selection of 11.2007 in the Free Char area will restrict the entire query results to this time period.
    Both your picks on time should be in selections in the Columns or the Rows.
    Regards
    Gill

  • 12 month but devided into current and previous year

    hi guys
    i have this requirement to disaply amount for current period and previous period for 12 month.
    Current period is the period of  user entered year and previous period is previous year 
    So if user enter feb 2007 u2026Then current year is  feb, jan ,dec 2006
    And previous period is   Nov 2006  to March 2006
    user is entering the value 0CALMONTH ...and report to need to display 12 month internval betwen years. my problem is how to check the year  and interval
    please help me without any custom exit? can it be possible thru varibale?

    Hi,
    I think i misunderstood your question previously.
    You can create offsets on CALMONTH and achieve this easily.
    1)In the columns are of query disigner, create selections for 12 months by using CALMONTH and offset each field by -1 or -2,-3,-4 ..... -12.
    2) Create a Text Variable to show the month Value in column header
    3) Create a structure in columns area and place it below all the CALMONTH selections
    4) Include all your Key Figures inside the structure.

Maybe you are looking for

  • Integration of SAP MI 7.1 and SAP PI 7.1 on the same Server

    Hi dear SAP Community, Does anyone know, if it's possible to use MI 7.1 and PI 7.1 on one server to create a big Enterprise Service Bus? Thank you! Best Regards Philipp

  • Number of GR/GI Slips

    Hello , I have a requirement where I want Number of GR/GI slips field to appear while doing GR through movement type 501, 503. The field is there for movt type 101. Please advise config changes. Thanks,

  • Getting every odd-numbered row from result set

    select * from mytable where MOD(rownum,2) = 1; Why does this not give me every odd-numbered row from result set? It returns just 1 row.... Thank u

  • Client Handling of EJB Exceptions

    I am using a session facade to interact with a series of entity beans through local interfaces. One of the entity beans has a "name" property that must be unique in the database. If I attempt to create one of these entity beans with a "name" that is

  • Opening Java folder in MSDOS prompt

    This is what happens when I try to open my Java folder in MSDOS prompt. Could somebody plese help me? C:\WINDOWS>Java -hotspot is a synonym for the "client" VM [deprecated] The default VM is client. -cp -classpath <directories and zip/jar files separ