Need help to calculate fiscal year related ...

DECLARE @now date = '2015-05-01';
DECLARE @this_year_start_date date = CAST(CONVERT(CHAR(5), @now, 120) + '10-01' AS date)
DECLARE @ytd_start_date date = @this_year_start_date
-- CASE WHEN @now = @this_year_start_date THEN @this_year_start_date ELSE DATEADD(YEAR, -1, @this_year_start_date) END
DECLARE @ytd_end_date date = @now;
DECLARE @sply_start_date date = DATEADD(YEAR, -1, @ytd_start_date);
DECLARE @sply_end_date date = DATEADD(YEAR, -1, @ytd_end_date);
select @now,@this_year_start_date,@ytd_start_date,@ytd_end_date,@sply_start_date,@sply_end_date
DECLARE @now date = sysdatetime();
DECLARE @this_year_start_date date = CAST(CONVERT(CHAR(5), @now, 120) + '10-01' AS date)
DECLARE @ytd_start_date date = @this_year_start_date
-- CASE WHEN @now = @this_year_start_date THEN @this_year_start_date ELSE DATEADD(YEAR, -1, @this_year_start_date) END
DECLARE @ytd_end_date date = @now;
DECLARE @sply_start_date date = DATEADD(YEAR, -1, @ytd_start_date);
DECLARE @sply_end_date date = DATEADD(YEAR, -1, @ytd_end_date);
select @now,@this_year_start_date,@ytd_start_date,@ytd_end_date,@sply_start_date,@sply_end_date
Second one work perfect  because fiscal year starts from 10/1  I am expecting current date, this year fiscal strat date correctly  when @now =2015-05-1 fiscal start  date also  should be 2014/10/1 but not working getting 2015-10-1 which
is not coming yet....

Same question,  
https://social.technet.microsoft.com/Forums/en-US/15619255-194b-4d54-9aaa-e43a602ee728/datetime-variable-to-make-dynamic-with-fiscal-start-date?forum=transactsql
Satheesh
My Blog |
How to ask questions in technical forum

Similar Messages

  • F4 Help Option for fiscal year/period to show most recent one first

    Hello Friends, We have audit team which wants this F4 Help for fiscal year/period to show the per/year in the current one first and then old one. Like 007/2007, 006/2007 -
    012/2005
    Please tell me if there is any Settings in Web template or in BI to make this work. Please help asap since auditor are required to test the reports for SOX.
    Thanks
    Regards
    SK

    i don't think it's possible... if you want you can restrict it to fiscal year 2007.

  • Need help on calculate

    I need to calculate 3 numeric fields and have a "A" at the 4th textField.
    example numericField1=40 numericField2=40 numericField3=20   and numericfield4 is the sum of 1, 2  and 3 so the total is =100 on numericfield4
    if this total is 100 then the letter A has to be the value of TextField1
    I did it this way on calculate - javascript
    if (numericField3 > 90 && numericField3 <100) {
    (TextField4 = "A");
    Well somthing like that and work.
    What I need and I have no Idea how to do it, is to have a more results(letter) like if the sum is between 70 and 89 the letter is B and if is between 50 and 69 the letter is C.
    but also if numerifield1= to 35 then even if the total is between 90 and 100 the Letter change to B
    here is why:  NumericField1 corresponds to COLOR. NumericField2 corresponds to DEFECT. NumericField3 corresponds to CARACTER and NumericField4 corresponds to the total puntiation. if the puntuation is between 90 and 100 is a GRADE A product
    but if the puntuation is between 90 and 100 but the NumericField1 is = to 35 then the result even is between 90 and 100 must be a letter B (or grade B)
    I don't know if I did it clear. hope so and hope some one can help me.
    Thank You

    what if I need a value range colo_ field?
    is this ok
    //form1.page1.subform1.grade_::calculate - (JavaScript, client)
    if (!(form1.page1.subform1.total_.rawValue == "" || form1.page1.subform1.total_.isNull)) {
      var n_ = form1.page1.subform1.total_.rawValue;
      if (form1.page1.subform1.color_ .rawValue > 32 && color_.rawValue < 35) {
        this.rawValue = "B";
      else {
        if (n_ > 89) {
          this.rawValue = "A";
        else {
          if (n_ > 69) {
            this.rawValue = "B";
          else {
            if (n_ > 49) {
              this.rawValue = "C";
            else {
              this.rawValue = "";
    Also need this for defect_ and character_

  • Need help for Calculate Percentage of Shares

    Hi Experts,
    I am Calculating Percentage of Shares using Down
    my Rule is
    Sub Calculate()
    Dim PDOwn
    Dim ACList
    Dim AC
    ACList=HS.Entity.List("AssociateJV","[BASE]")
    For each AC in ACList
    PDOwn = HS.Node.DOwn("S#ACTUAL.Y#2010.P#March.E#AssociateJV."& AC)
    HS.Exp "A#AC SHARES=A#TOTSH*"& PDOwn
    next
    End sub
    But the answer is AC Share=0.00 So i need for help to Correct that value

    Dear Murali,
    Create a routine as suggested and assign it against your condition type (for which you need the calculation) as
    alternative calculation type.
    Check and revert back.
    Thanks & Regards,
    Hegal K Charles

  • Need help and advice on designing relations of classes

    I tried to use JInternalFrame which contains an extension of JPanel as the UI content (with actionListener for the buttons inside it). The Panel is contained in a JScrollPane.
    jIntFrm = new JInternalFrame("-Title-", true, true, true, true);
    jIntFrm.setLayout(FlowLayout());
    jIntFrm.add(new JScrollPane(new PnlEntry()));
    The user clicked the button inside the panel (PnlEntry) to close the JInternalFrame containing this panel or another button to do operations that will need to display another JInternalFrame containing another extension of JPanel.
    Please give me advices on how these should be done, so that it makes good OO relations.
    Right now, I'mdoing it like this:
    public class mainFrame extends JFrame{
    JInternalFrame jIntFrm; //AND OTHER INTERNAL FRAME
    jIntFrm = new JInternalFrame("-Title-", true, true, true, true);
    jIntFrm.setLayout(FlowLayout());
    //THE PANEL IS GIVEN THE REF AND MEMORIZE IT UNTIL IT
    //INVOKES mainFrame.panelExit(JInternalFrame)
    jIntFrm.add(new JScrollPane(new PnlEntry(this, jIntFrm)));
    panelExit(JInternalFrame jif){
    if(jif == jIntFrm){
    jIntFrame.dispose();
    jIntFrame = null;
    panelContinueProcess(JInternalFrame jif, Object someID){
    if(jif == jIntFrm){
    jIntFrame.dispose();
    jIntFrame = null;
    //start displaying another JInternalFrame with the appropriate Panel in it
    Is this all is OK?
    Please give me your advice
    Thx,
    David

    Maybe read on MVC (Model-View-Controller) pattern? It's practically the standard for Swing applications (even Swing itself follows the pattern).
    You don't want to clutter your frame with behavioral code.

  • Need help please! boot camp related

    Im in desperate need of help.
    Heres the story:
    I partioned my drive to 100 gb windows (xp home), with about 131 gb for Leopard.
    I followed the prompts during the installation, until i got to the screen listing the available drives for installing windows. The only drive that came up was the 131 gb one, which was the Leopard-dedicated section with all of my data on it.
    I restarted the computer several times to no avail. I still just had the 131gb option come up. I did click on the 131 gb drive option (out of desperation i guess) but when prompter to install, i quit the application.
    After restarting the laptop several more times and trying again, i took out the xp cd having given up on the whole thing. Upon doing so, a blank white screen came up, which after about 10 seconds turned into a dark screen with a white flashing line at the top left hand corner.I tried restarting and waiting but nothing worked.
    Ive browsed some other forums and found out that by holding the 'opyion' key at start up you can switch between drives. When i tried this, it only gave me one drive to choose from, which was labelled 'windows'. I clicked on it and got the same white then dark with flashing line screens.
    In serious need of help, if ive lost all of the data on that leopard drive im royally screwed.
    Hopefully that was comprehendable, any help will be appreciated greatly.
    Message was edited by: seb123

    I had exactly the same problem a few weeks ago (with a XP Pro SP2), and as you did, and being as desperate as you were, I also clicked on the 131 drive option. The result was : start-up drivers were broken, so the machine had to go back to Apple care center and I got it back three weeks later. All my data were lost, they even had to change the hard drive. Strange thing was I didn't have to pay anything for that (whereas I did recognize that this was my fault for I selected a wrong partition). So I guess Apple is now experiencing some problems with Bootcamp… Anyway you shall never select any other partition as the one wich is named "Bootcamp". Otherwise you can overwrite all your OS X soft and this can be some sort of nightmare. Sorry. When I got back my iMac I tried again (with 70 GO for Windows that time) and the same things happened ; but this time as I saw only one partition I just quit the whole thing (F3 key) and got back to OS X, and re-opened Bootcamp to get back to a single Mac OS partition. No problem… but no Windows. I think we'd better wait for further info from Apple. Perhaps we can also try with 32 Go partition and FAT format and see what happens then (I think I will try this). Or buy a Vista and see what happens (NTFS format required but automatic, so it seems to be easier).
    Did you try to install XP or Vista ?
    Good luck
    Regards.
    And have a look on this forum, unless you already did it :
    http://discussions.apple.com/thread.jspa?threadID=1199436&tstart=0
    I must admit I don't really understand what they say about freeDOS, but this must be read…

  • Need help to calculate delta value

    Can someone please help me with this?
    I have a source table like:
    device        index     value                     time
        a              1         15               2009-07-07 12:00:00
        a              1         20               2009-07-07 13:00:00
        a              1         25               2009-07-07 14:00:00
        a              1         30               2009-07-07 15:00:00
        a              2         10               2009-07-07 12:00:00
        a              2         20               2009-07-07 13:00:00
        a              2         30               2009-07-07 14:00:00
        a              2         35               2009-07-07 15:00:00
        a              3         30               2009-07-07 13:00:00
        a              3         40               2009-07-07 15:00:00And the final table I need to generate is like
    device        index     value                     time
        a              1         5               2009-07-07 13:00:00
        a              1         5               2009-07-07 14:00:00
        a              1         5               2009-07-07 15:00:00
        a              2         10             2009-07-07 13:00:00
        a              2         10             2009-07-07 14:00:00
        a              2         5               2009-07-07 15:00:00
        a              3         30             2009-07-07 13:00:00
        a              3         0               2009-07-07 14:00:00
        a              3         40             2009-07-07 15:00:00Thanks a lot for your help!

    Sounds like you need to fill in some gaps.
    You can use a partitioned join to fill in the gaps, then use the analytic funcitons. See [http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/analysis.htm#sthref1836] for more info on partitioned joins.
    Here's my original query with an updated middle (t2 now t3) query
    with t1 as (select 'a' device, 1 IND, 15 "VALUE", to_date('2009-07-07 12:00:00','rrrr-mm-dd hh24:mi:ss') "TIME" from dual
      union all select 'a', 1, 20, to_date('2009-07-07 13:00:00','rrrr-mm-dd hh24:mi:ss') from dual
      union all select 'a', 1, 25, to_date('2009-07-07 14:00:00','rrrr-mm-dd hh24:mi:ss') from dual
      union all select 'a', 1, 30, to_date('2009-07-07 15:00:00','rrrr-mm-dd hh24:mi:ss') from dual
      union all select 'a', 2, 10, to_date('2009-07-07 12:00:00','rrrr-mm-dd hh24:mi:ss') from dual
      union all select 'a', 2, 20, to_date('2009-07-07 13:00:00','rrrr-mm-dd hh24:mi:ss') from dual
      union all select 'a', 2, 30, to_date('2009-07-07 14:00:00','rrrr-mm-dd hh24:mi:ss') from dual
      union all select 'a', 2, 35, to_date('2009-07-07 15:00:00','rrrr-mm-dd hh24:mi:ss') from dual
      union all select 'a', 3, 30, to_date('2009-07-07 13:00:00','rrrr-mm-dd hh24:mi:ss') from dual
      union all select 'a', 3, 40, to_date('2009-07-07 15:00:00','rrrr-mm-dd hh24:mi:ss') from dual
    ), t3 as (
    select t1.device
         , t1.ind
         , nvl(t1.value,lag(nvl(t1.value,0)) over (partition by t1.device, t1.ind order by t2.time))
           - lag(nvl(t1.value,0)) over (partition by t1.device, t1.ind order by t2.time) "VALUE"
         , t2.time
      from t1
      PARTITION by ( t1.device, t1.ind)
      right join (select distinct time from t1) t2
        on t1.time = t2.time
    select * from t3 where value is not null
    DEVICE IND                    VALUE                  TIME                     
    a      1                      5                      07-JUL-2009 13:00:00     
    a      1                      5                      07-JUL-2009 14:00:00     
    a      1                      5                      07-JUL-2009 15:00:00     
    a      2                      10                     07-JUL-2009 13:00:00     
    a      2                      10                     07-JUL-2009 14:00:00     
    a      2                      5                      07-JUL-2009 15:00:00     
    a      3                      30                     07-JUL-2009 13:00:00     
    a      3                      0                      07-JUL-2009 14:00:00     
    a      3                      40                     07-JUL-2009 15:00:00     
    9 rows selectedNote: I had to finegle the NVL function first half of the value expression to get the result to be 0 instead of -30. If you want it to be -30 instead just change that nvl function to nvl(t1.value,0) instead.
    Edited by: Sentinel on Jul 8, 2009 4:40 PM

  • Need help to calculate capacities of tool life and forecast problems

    We want to track the parts and suppliers tools in SAP and calculate the capacities and tool life to forecast upcoming problems. We need to capture this information in PM module and track shelf life and create maintenence  plans  for parts. How can I create maintenence plans for the parts? I am aware of equipment and FLOCs to create maintence plans but not aware of creating maintence plans for parts!. Can somebody provide guidance?

    The following is an idea to achieve your requirement on your pre-condition that you can not have Equipment numbers to your Tools
    So, the previous reply hints at having Measuring points (Counters)  on the Press with various tools in Measuring Positions. i.e The Press 3000001 will have one Measuring point say 1234 with a characteristic say NoOfTanks pressed where Tool-Id (maintained outside SAP say Tool001) is given in Measuring Position field. Similarly another MPoint on 3000001, say 1235 will have same characteristic, but with Tool002 in MPosition field.. and so on..
    You will be creating documents on these MPoints (Counters) as per No of Tanks pressed. So when the Counter reading  of a MDoc of a MPt (say 1235) reaches 10000, you will perform maintenance activity on Tool002.
    Here comes the decision of yours to do it (watching for maintenance call) manually or through development. Manually means you will watch IK17 report and upon CntrRdg reaching 10000 you will perform the Maintenance Activity and record the same in the Document text / Longtext (MDTXT field)  of the 10000 TotcntrRdg  document.
    OR
    To get this alert (Notification or even Order) triggered by the system, you can use User-Exit IMRC0001, This is the job of your ABAPer.
    If some way is suggested by experts, in standard maintenance scheduling itself, then obviously, naturally you should be adopting the same.
    Best of luck
    Jogeswara Rao K

  • Need Help to calculate difference between times

    Hello everyone,
    I have two fields which just stores the time in 24 hour format ex: 08:00 and 20:00 now I want to calculate difference between the two times
    Kindle help me
    Thanks for your help
    Thanks
    Ravi

    Are your fields of varchar2 datatype or...?
    Is 08:00 the start time or 20:00?
    Date arithmetic is pretty simple in Oracle if you use the right datatype.
    See:
    http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551242712657900129
    Assuming you are storing strings:
    SQL> -- generating sample data:
    SQL> with t as (
      2  select '08:00' btime, '20:00' etime from dual
      3  )
      4  --
      5  -- actual query:
      6  --
      7  select numtodsinterval(to_date(etime, 'hh24:mi') - to_date(btime, 'hh24:mi'), 'day') nti
      8  ,      (to_date(etime, 'hh24:mi') - to_date(btime, 'hh24:mi'))*24 dt
      9  from   t;
    NTI                                                                                 DT
    +000000000 12:00:00.000000000                                                       12
    1 row selected.
    SQL>

  • I need help canceling my one year membership

    Started the membership thinking it was one thing and turned out to be another. I would like to cancel the membership and possibly get reimbursed for the first month thank you

    Please confirm you would like to cancel the CC purchased on September 22nd 2014. I can get that done for you. You can confirm it by private inboxing.
    You can also follow the steps in Cancel your membership or subscription | Creative Cloud
    Regards
    Rajshree

  • Multiple Fiscal Year Variant in the same client in SEM-BCS...

    I have already looked at some earlier threads relating to this but didn't get a convincing answer to what I would like to know.
    We have had a working SEM-BCS system with fiscal year variant K4. There was no need for defining leading fiscal year variant and none was defined. SAP, by default takes, K4 as the leading fiscal year variant.
    Now there is a requirement for going on a different fiscal year variant for which we have created another databasis (there were a few other reasons besides these) with the same InfoObjects that we used earlier but with different fixed parameters, one of which is fisc year variant V9. Soon, we started experiencing bizarre dumps in the configuration which ultimately convinced me to define a leading fiscal year variant. I was reluctant to do so because there is a lot of old data (which will become 'historical' from new data basis point of view) from the working system on K4 that would still need to be reported on even when we have new BCS solution in the new fiscal year variant V9. That is not going away. There is a need to keep the old data for reporting (hence the rationale for a different data basis among a few others).
    Since earlier Master Data was configured in the old fisc year variant K4, now I have defined the leading fiscal year variant as V9 so that MDF can appropriately identify the period dependency.
    I would like to know if any of you have had an unexpected behavior from the system going forward. Does the system dump out when you try to read the old data (from earlier K4).
    I have tried to explain the dilemma as clearly and succinctly as possible but if you need more clarifications, please do let me know.
    I would really appreciate your help in this.

    Is your requirement is that K4 to be changed to Z5.
    The best way you can do it is in the transformation. Instead of directmapping,
    Write a code like this in the trransformation to the cube
    If SOURCE FIELD - 0FISCVAR eq 'k4'.
    SOURCE FIELD - 0FISCVAR = 'Z5'.
    I dont think we can change th data in the query being displayed. we can change the keyfigure values in query by frmulas etc...
    but for a characteristic, i think we will be able to restrict bt not change the value.
    to obtain the requirement, w have to get the data change before query designer that is in the cube leve.
    Hope this helps,
    Sri...

  • Changing Depreciation Key for Tax for closed fiscal years -

    Hello,
    Hoping someone can help me with this question - Is it possible to change the depreciation key for closed fiscal years - we need to change it for Tax - books. And if yes - does it mean we need to open closed fiscal years ??
    Thank you,
    Richa

    Hi,
    you will need to open the FI and AA periods. After changing the depreciation keys do the necessary dep run and close the books in the correct sequence.There should not be problem.

  • Version 0 is not defined for fiscal year 2012.

    Hello Experts,
    While am tring to release  a work order, i am getting the below error.
    Version 0 is not defined for fiscal year 2012.
    Message no. GP626
    Diagnosis
    The version 0 is not defined in controlling area DE06 for the fiscal year 2012.
    You have to maintain the fiscal year-dependent version parameters for all actual versions for which multiple valuation is updated.
    System Response
    The version 0 cannot be used for fiscal year 2012.
    Procedure
    Maintain the fiscal year-dependent version parameters for the version 0.
    Execute function
    By this what i understood is we need to change the Settings for each fiscal year for the version 0 in controlling area DE06.
    i.e. we need to add the fiscal year 2012 in that.
    Is this correct????
    If yes what will be the impact of adding 2012 in that screen?
    i think its a soft config only.
    Please let me know the correct process
    Thanks in Advance,
    Satya

    Version 0 is not defined for fiscal year 2015.
    What to do next ? Please help with it.

  • Fiscal year "A3" Variant is not maintained for Financila year 2010

    Hello All,
    while creating asset master using AS01 T Code i am getting an error "Fiscal year "A3" Variant is not maintained for Financila year 2010 for Compnay Code 0600".
    but i have configured Fical year variant and assigned to co code, i am able to post the transactions for all the periods i.e financial year 2010.
    here my question is whether we need to maintain the Fiscal year variant separately for Asset accounting in ECC 6.0.
    Please Suggest
    Thanks
    Shankar

    Hi Murali and Christian,
    Thanks for your reply..
    now i have configured year dependent fiscal year to my co code, if i configure calender year i am able to create the Asset master
    please help
    Thanks
    Shankar

  • Sugestion required for Fiscal Year scenario

    Hi Gurus,
    I  need your suggestion for the below scenario
    One of our client going to  change the Fiscal period  from  (Jan -  dec ) to (Sep - Oct). We have nearly 5 years of records as on date based on the (Jan-Dec) fiscal period.
    Requirement: If new fiscal peirod will come in active , they want to view all the data ( Including  historical records)based on the both the fiscal period based on the selection in the query.
    Technical requirement: Dynamic switching is requried for Fiscal Year Variant in the query level. 
    Suggestion Required for below point:
    1. Is it required to maintain two Fiscal year variant ?
    2.How do we maintain the new fiscal year period for historical record ?
    3. Is it any posibilities their with out major disturbance of the existing query ?
    4. Is it possible to do in query level with minor impact of performance ?
    5. Is it possible to do in back end side with out redundancy of the records ?
    6.I have a solution to use multiprovider on top of two infoprovides which are maintain the fiscal period based on two fiscal year variant. If I realize this it would lead major back end work.
    7. I have another solution to add another two fields in the existing structure to hold new variant and fiscal period. If I do this How dynamically I can change the structure of the query for to view the different fiscal period information.
    Anticipate your reply eagerly
    With Regards
    Siva

    Hi,
    1. Is it required to maintain two Fiscal year variant ?
    Yes,  You will need to  have another Fiscal Year variant for Sep to Oct.
    2.How do we maintain the new fiscal year period for historical record ?
    To do this at the BI Level, You can have a routine to convert the Fiscal Year Period according to the new Variant.
    You will have to get the help of a functional consultant in order to understand the logic of opening and closing balance. According to the new variant the current Fisc Period 009.2009(Sep 2009) will become 001.2010 and so on. Apart form just converting the period, you will also have to take care of carrying over the balances.
    3. Is it any posibilities their with out major disturbance of the existing query ?
    Once you implement the above logic, you can just include the New Fiscal variant into the query.
    4. Is it possible to do in query level with minor impact of performance ?
    Yes, as mentioned above.
    5. Is it possible to do in back end side with out redundancy of the records ?
    Not sure about this.
    6.I have a solution to use multiprovider on top of two infoprovides which are maintain the fiscal period based on two fiscal year variant. If I realize this it would lead major back end work.
    This seems to be the best way. You will not have to touch the existing cube. Only your reports will have to be copied to the New MultiCube. The logic in the 2nd Q above will be for the new cube.
    Regards,
    Gaurav

Maybe you are looking for

  • Setting up a gift iPad for a different country

    Hi, Here's what I am trying to do. I live in US and my sister lives in India. I am going to visit her soon. I bought an iPad 2 for her as a gift. I would like to do the initial setup of the iPad when I am in US before I go to India and load the iPad

  • Standard report on Stock Status

    Hi, I need stock report in Inventory with the following output fields, 1.Material 2.Material Description 3.Flagged Material For deletion (Yes/No) 4.Plant 5.Storage Location 6.Division 7.Valuated Stock (Qty & Value) 8.Consignment Stock (Qty & Value) 9

  • Edit proposal TDS amount can we change

    Hi Team, During the payment run, we have the edit proposal option. In this option can we change the TDS calculated amount or base amount. Thanks & regards Amar N Adam

  • SharePoint 2013 with Yammer & Jive Comparison for social networking features

    My client purchased Jive, is there any space to increase the use of SP's social networking default features or with yammer? Can SP handshake Jive to work in both products seamlessly? Sumeet Singhal

  • Issues with FCE4: saving, filters, rendering...

    Hello, all - I'm just learning this application, and I can't figure out if I'm doing something wrong or if my software is acting up... but I can't save. "Save" is grayed out, and hitting command-S does nothing. Yet, if I try to quit the application i