How to calculate Prior Year To Date in SSRS

Hi,
I've been developing reports in Crystal for a while. The new ERP software we have just purchased uses SSRS for all of their reports. I just started converting the crystal reports to SSRS. I can't seem to find an easy way to do a calculation for Prior Year
to Date or Prior Year Month to Date in SSRS. Can somebody help me?
Thanks,
Cindy

Your best bet would be to use a calendar table in the TSQL queries. I wrote an article on them here: http://social.technet.microsoft.com/wiki/contents/articles/29260.tsql-calendar-functions-and-tables.aspx
Alternatively you can use a formula like:
=DateValue(DATEADD(DateInterval.Day,1-DATEPART(DateInterval.DayOfYear,NOW()),Now()))
Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

Similar Messages

  • How to calcualate prior year

    Hi All,
    If I select current year in a column promt, then I want to calculate prior year.
    For eg. I have List Box promt based on year column with values 2012, 2011, 2010, 2009, 2008 etc..
    If I select any one year, lets say 2011, then I should automatically calculate prior year which is 2010 so as to pull data in analysis for 2011 as well as 2010.
    How to achieve this.?
    Thanks in Advance
    Warm Regards
    Santosh

    Thanks Deva and Satya for your inputs..
    Now please look at the following situation ..
    I need to create a PnL report such that I show current years profit and loss AND prior year profit and loss figures in a report side by side for comparitive analysis for user.
    My data is an essbase database, and have a years dimension with values 'current year' , 'F08', and 'Prior Year'. and other measurs such as net revenue, % revenue, gross profit, cost of sales, operating expenses etc. (I am using 107 from oracle downloads) for obiee 11.5
    I also have a scenario dimension with members as Actual, plan, Forecast, Wht -if..
    Now I need to create a this report.
    I created this report based on my approch mentioned below;
    Appraoch 1
    - Created two analysis reports with all the above columns.
    - specified filter for year column equal to 'current year' for first report
    - specified filter for year column equal to 'prior year' for second report
    - created a dashboard with a promt (radio button) based on column scenario with all values (Actual, plan, Forecast, Wht -if)
    - created two sections placed side by side below the prompt and placed thoese reports in those two sections so that they appear side by side.
    The promt is placed above those two sections.
    Nw when I run this dashboard, it works fine, and shows me the current and prior data for actual, plan etc...
    BUT....
    I need to create the same information for current and prior year PnL using a single analysis report instead of two separate reports with hardcoded values
    for year filter.
    Now I tried use AGO funtions on but , it requires a column with numerical value so that it can calculate the past year, but in my case, year is a column
    hving text values ('current year' , 'F08', and 'Prior Year') and hence I cant use it.
    I would like to know how to build such a report using any other approach (using variables or function or any rpd level modifitions).
    Is there any trik which I can do at report level , (duplicatiing columns or any other thing ) I can do this?
    Please help me to build logic either at analysis level or at repository level
    Thanks and Regards
    Santosh

  • ABAP-HR MODULE(HOW TO CALCULATE AGE & YEARS OF SERVICE)

    HI,
    HOW TO CALCULATE AGE & YEARS OF SERVICE means for example
    I AM USING PNPCE LDB.
    (1) whose age is greater than 52.833 years with 7.833 years of service, with annual rate of pay $170,000 or more, or
    (2) age plus employment service is 65 or more, with annual rate of pay of $ 170,000 or more.
    Note that the $ 170,000 parameter would be a variable that could change annually when this report would be generated. In the past, age and service value were determined as of the run date. The determination date would also be a variable that would change when the report would be generated.
    Thanks&Regards
    Rahul.

    Hi Rahul,
    This is the 2nd warning !!! Please... use the correct or most appropriate forum.
    The ABAP Objects Forum should be used for: ABAP Object definition and implementation including encapsulation, interfaces and inheritance in ABAP Objects.
    This thread will be moved from to .
    You're asking this question in two thread, so the duplicated thread will be deleted.
    Please have a look at [Forum Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] before posting.
    Also read this thread Welcome and Rules of Engagement.
    Greetings,
    Marcelo Ramos

  • How to calculate days between two DATES

    How to calculate days between two DATES ?
    which is the functional module for that ?
    help me

    Hi,
    use function module : it works,
    HR_HK_DIFF_BT_2_DATES
    give output format = 03 and get the value in days.
    code is as below :
    data : DATE1 type P0001-BEGDA,
    DATE2 type P0001-BEGDA,
    YEARS type P0347-SCRYY,
    MONTHS type P0347-SCRMM,
    DAYS type P0347-SCRDD.
    date1 = '20070331'.
    date2 = '20070101'.
    CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
    EXPORTING
    DATE1 = date1
    DATE2 = date2
    OUTPUT_FORMAT = '03'
    IMPORTING
    YEARS = years
    MONTHS = months
    DAYS = days
    EXCEPTIONS
    INVALID_DATES_SPECIFIED = 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.
    write : days.
    Reward points, if helpful,
    Regards,
    Sandeep Kaushik

  • CURRENT YEAR SALES DATE PARAMATER AND PRIOR YEAR SAME DATE RANGE

    I am pulling data from a SQL view dbo.view that has current and historical SOP data by line.  The date paramater is a date range,  uppr date and lower date formulas are in the report.  I need to include prior year SOP data for the same prior year date range in the detail.  I have tried adding the view in twice with no luck, just duplications.  Ultimately I want to supress the detail and only show the totals by customer so it is comparitive.  Thanks for your help.  Jayne

    OK
    lets simplify it
    get a test data source with some simple dates in it.
    get the report logic working.
    it looks like you have the right formula ideas but lets go for
    @upperthisyear
    @upperlastyear
    @lowerthisyear
    @lowerlastyear
    then assuming a date field of {table1.date}
    the record selection would be
    if (@upperthisyeare > {table1.date} and @lowerthisyear < {table1.date}) or (@upperlastyeare > {table1.date} and @lowerlastyear < {table1.date}) then 1 else 0
    I would test this by using it as a formula field with the test data.

  • How to calculate Beginning , Current & To date opening Balances

    Hi to all
    Anybody know that How to calculate Beginning , Current & To date opening Balances in Oracle Payable
    Thanks
    Zulqarnain

    sorry igonore above one
    i don't want last day of the month
    i want last working day of the current month
    please solve this
    urgent

  • How to Find the Year to Date ?

    Dear Experts
    How to find the Year to date in BI 7.0 i.e(1st April of Current year  to Tilldate) is there any Standard Variable is there ,Please let me know .as we are needed in our project.
    Thanks in Advance
    Satish

    Hi,
    I hope Stadard variables(Cumilated upto current fiscal year-0FYTCFP) will be avalable for this kind of requirement. Try to create a restricted key fig by make use of the standard variables...
    This is just my assumption.
    Message was edited by:
            Kameswari Ponnuri

  • How to Calculate Leap Year ago in OBIEE 11g

    Hi Gurus,
    I have one fact table and having one measure column. I have to calculate current year and Last year.
    Using Time series function (Todate,Ago) have calculated current year as well last year also.
    The problem is Current year is showing correct value only but Last year was showing wrong data.
    We found the problem is Leap year, last year FEB month is having 29 dates. Due to this we are getting wrong date.
    Kindly suggest me how to achieve this requirement.
    Thanks

    Hi Gurus,
    How to resolve Leap Year calculation in OBIEE 11g.
    The problems is Year Ago column.
    Please suggest me how to resolve this.
    Thanks

  • How to calculate financial year

    Hi,
    How to calculate financial yearfrom 01.04.2008 to 31.03.2009.
    regards
    nani

    Hi,
    use the below FM's
    GM_GET_FISCAL_YEAR
    GET_CURRENT_YEAR
    CALL FUNCTION 'GET_CURRENT_YEAR'
    EXPORTING
    BUKRS = '1000' " Company Code
    DATE = SY-DATUM " Date to find fiscal year for
    IMPORTING
    CURRM = w_currm " Current Fiscal Month
    CURRY = w_curry " Current Fiscal Year
    PREVM = w_prevm " Previous Fiscal Month
    PREVY = w_prevy. " Previous Fiscal Year
    but this will help you for a particular company code ACE_CHECK_FISCAL_YEAR
    Thanks

  • How to calculate the volume of data used (PI licensing limit).

    Hi,
    One of our customers has several interfases running on SAP PI. They have a license that allows them the use of PI for a quantity of Gb in message data per month (I think that's the usual way).
    They would like to know how near/far they are of their limint of data, so they would like to know how does SAP evaluate that.
    Does  anybody know wich tool(s) are used by SAP to calculate the volume of data spent in one month?. We would like to launch those tools and get this info (so we can evaluate if we can add new interfases or change the periodicity of existing ones within the limits of the current license).
    Thanks in advance for your help.
    Best Regards
    Rafa

    Hi Mark,
    I have a quick question. The links that you provided gives an idea of the way in which the volume is calculated. This is helpful.
    My question is regarding Auditing and Compliance:
    Client has bought SAP PI licence for certain GB of data per month.
    Can this report be generated automatically classified by SAP and Non SAP Systems (PI licence volume constraints are normally for data exchange for non SAP Systems)?
    Also can this data be measured at Adaptor level? How does one monitor data at Adaptor level.
    Thanks And Regards,
    Maloy

  • How to derive month/year from date in SAP BW 3.5 data flow

    Hi
    How we can derive cal year/month and fiscal month/year from date in SAP BW 3.5 data flow (we're using transfer and update rule)..
    Thanks,
    PK

    Hi,
    if you have any date filed in source side you can just map to any time char system will automatically convert to target objects.
    please look at the screen shot for understanding. (not 3.x it is 7.x)
    Thanks,
    Phani.

  • How to calculate Last year in BEx Report

    Hi Experts
    I have a requirement to create report in BEx --> report output will be Amount, Diff in percentage(Plan-Actual),Last year
    My question how we calculate the Last year and actual minus plan difference in percentage

    Hi,
    Make use of % functions in query designer to get the desired result.Please search on forum lot of examples will be there.
    Hope it helps.
    Regards,
    AL
    Edited by: AL1112 on Mar 7, 2011 4:56 PM

  • How to calculate days between 2 dates excluding public holidays over SAP ?

    Hi
    Have a universe over SAP data. Trying to calculate days between 2 dates. SAP holds Public Holiday data in various tables e.g  Thol and data is updated via scal. Using my univeres as a source I want to run  reports for different countries so need to have various bank holidays not just UK. In SAP function modules handle this. Has anyone designed a solution to cater for this situation in a universe ?
    Thanks in advance
    M

    Hi,
    I assume you mean SAP R/3 (ECC) when you write SAP and SAP BW.
    Are you using BW? If so, I would load the data into SAP BW, create a query using customer exit variables and build your universe on top of that...
    -J

  • How to create a year to date filter?

    All,
    I would like to create a date range filter on the opportunity close date column so that the report retrieves records with a close date between the beginning of the current calendar year and the current date.
    I am having trouble using date/time functions to establish the first day of the current calendar year.
    Any help is appreciated.
    Thanks,
    Dan

    I'm so sorry... I missed this thread and have not replied.
    You could place a filter on the Fiscal Year column in the Date Dimension folder of your subject area to get Fiscal Year to Date (most of the time):
    Date."Fiscal Year" = VALUEOF(NQ_SESSION.CURRENT_YEAR)
    This would likely not work, however, if the current year is 2008 and you are already in Fiscal Year 2009.
    To allow for this, your filters become much more complex. I will use Opportunity Close Date in my example.
    First, we want to ensure that no data in the report is more than one year old...
    TIMESTAMPDIFF(SQL_TSI_DAY, Opportunity."Close Date", CURRENT_DATE) < 366
    With the next filter, we want to ensure that the data in the report is not from months outside of the fiscal year. You can do this with a CASE statement in a hidden column.
    CASE WHEN MONTH(Opportunity."Close Date") > 06 AND YEAR(Opportunity."Close Date") < VALUEOF(NQ_SESSION.CURRENT_YEAR) THEN 'Current Fiscal Year'
    WHEN MONTH(Opportunity."Close Date") < 06 AND YEAR(Opportunity."Close Date") = VALUEOF(NQ_SESSION.CURRENT_YEAR) THEN 'Current Fiscal Year'
    ELSE 'Not Current Fiscal Year' END
    Your Filter will be:
    CASE WHEN MONTH(Opportunity."Close Date") > 06 AND YEAR(Opportunity."Close Date") < VALUEOF(NQ_SESSION.CURRENT_YEAR) THEN 'Current Fiscal Year'
    WHEN MONTH(Opportunity."Close Date") < 06 AND YEAR(Opportunity."Close Date") = VALUEOF(NQ_SESSION.CURRENT_YEAR) THEN 'Current Fiscal Year'
    ELSE 'Not Current Fiscal Year' END = 'Current Fiscal Year'
    Assuming my code is correct, July 2007 - June 2008 evaluates as current fiscal year and July 2008+ evaluates as not current fiscal year.
    There are bound to be other ways to accomplish this, but this is one method that should work.
    Regards,
    Mike L

  • DAX - Querying: How to reinforce a filter in order to calculate a year to date

    Dear community,
    I am pulling my hair off due to an issue I am having with the creation of a DAX query (supposed to feed an SSRS report).
    The topic is P&L related, I need to compute the revenue based on specific cost elements, that same query must return additional columns that represent YTD, Forecast,... etc ( a couple of typical aggregations).
    First of all here is the query I currently simplified to explain my issue:
    EVALUATE
    CALCULATETABLE(
    SUMMARIZE(
    GENERATE(
    VALUES(AccountingPeriod[RealAccountingPeriod]),
    FactFInancialTransaction
    AccountingPeriod[Code],
    CostElement[Code],
    CostElement[Group],
    "Revenue", [Revenue],
    "GroupRevenue",
    CALCULATE(
    [Revenue],
    all(CostElement[Code])
    FILTER(
    VALUES(CostElement[Code]),
    CostElement[Code] = "RSFOR" ||
    CostElement[Code] = "RSTHI" ||
    CostElement[Code] = "RSOTH"
    FILTER(
    VALUES(CostElement[Group]),
    CostElement[Group] = "RGOVE"
    FILTER(
    ALL(AccountingPeriod),
    AccountingPeriod[Code] = 201402
    FILTER(
    VALUES(OperationalUnit[OperationalUnitNumber]),
    VALUES(OperationalUnit[OperationalUnitNumber]) = "052"
    The Revenue is simply a SUM of an amount column in FactFinancialTransactions.
    What I am unable to do is compute GroupRevenue where I simply would like to sum the revenues for the elements. Does anybody have an idea on the calculate statement that will help me achieve this?
     I tried doing something like:
    CALCULATE(
    [Revenue], all(FactFinancialTransactions),
    all(CostElement[Code]), Values(CostElement[Group]), Values(AccountingPeriod[code]) Values(OperationalUnit[OperationalUnitNumber]) )
    This does not work at all, it looks like the VALUES(OperationalUnit[OperationalUnitNumber]) context is not reinforced, the value I get in return is actually the one summing ALL operational units.
    PS: I have to keep the filter on OperationalUnit as is because it will actually be a pathcontains statement that can pass multiple values
    Thanks so much for any help
    Mils.

    I am not entirely sure about your requirements and your data model.
    However, I would start using ADDCOLUMNS instead of SUMMARIZE to add columns to the group you need.
    EVALUATE
    CALCULATETABLE (
        ADDCOLUMNS (
            SUMMARIZE (
                GENERATE (
                    VALUES ( AccountingPeriod[RealAccountingPeriod] ),
                    FactFInancialTransaction
                AccountingPeriod[Code],
                CostElement[Code],
                CostElement[Group]
            "Revenue", [Revenue],
            "GroupRevenue", CALCULATE ( [Revenue], ALL ( CostElement[Code] ) )
        FILTER (
            VALUES ( CostElement[Code] ),
            CostElement[Code] = "RSFOR"
                || CostElement[Code] = "RSTHI"
                || CostElement[Code] = "RSOTH"
        FILTER (
            VALUES ( CostElement[Group] ),
            CostElement[Group] = "RGOVE"
        FILTER (
            ALL ( AccountingPeriod ),
            AccountingPeriod[Code] = 201402
        FILTER (
            VALUES ( OperationalUnit[OperationalUnitNumber] ),
            VALUES ( OperationalUnit[OperationalUnitNumber] ) = "052"
    Marco Russo (Blog,
    Twitter,
    LinkedIn) - sqlbi.com:
    Articles, Videos,
    Tools, Consultancy,
    Training
    Format with DAX Formatter and design with
    DAX Patterns. Learn
    Power Pivot and SSAS Tabular.

Maybe you are looking for

  • Edit Contact and/or Item in an open call.

    Is there a way to edit the contact and/or item a call is logged against? Both for manually entered calls and for Calls opened via email. LiveTime docs certainly seem to suggest that a call opened via email using the 'Unknown' item can be edited to as

  • Sales order creation  by using LSMW

    Hi All, We have designed one LSMW program by which we are able to create Sales Orders. Import method for this LSMW is *BAPI Method*.So finally by processing IDOC steps, sales orders getting created. My req is   1) We have to schedule a background job

  • How to post idoc ORDERS05 from ABAP standalone program to the same R3 syst?

    Hi Masterminds, I need to post IDoc from ECC to same R/3 system. For that i need to develop a standalone program which will post Idoc 'ORDERS05'. I had the following data: E1EDKA1                         - PARTN E1EDK02; QUALF = 001        - BELNR E1

  • Zen V Plus Display Window Sym

    hello board, My husband surprised me with a new Zen V Plus to listen to audio books. Everything seems to be working ok but all of a sudden there is a new "symbol" in the upper right hand corner of the display window that looks like two circular arrow

  • Can I change live:???? To skype name ?

    Can I change live:???? To skype username ? I think it easier to add friends by skype surname