Calculation of number of Days?

Hi Experts,
i have two key figures one is calulate the number of day and the other is calulate the total number of stocks.
So now my requirment is the user want to see the data like this,in report level.
for Exp:
if Number of days in between   10 -60 total stock is 100
if Number of days in between    70- 80 total stock is 200
if Number of days in between    81-130 total stock is 500.l  ike this.
so how can i achieve this in query designer as i am using BI(7.0)?
Regards,
sat

Hi ,
Before posting a thread please provide the minimum info so that you can get the exact reply for your post.
What are the data fileds that you have in your target to calculate the no of days?
What is the source and IC on which you want to design the report?
If u have any smaple data how you want the report to be? etc....
If you have the date fields in your info provider then create 2 formula variable of type replacement path on both the date fileds.
create a formula where use these two formula variables to get the difference of days.
after that create one more formula and use
((diff of days>=10)AND(diff ofdays<=60)*Kf) will give you the stock value during that bucket.
For more info plz refer to the below link which explains about the bucketing scenario.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30f15839-0cf1-2b10-c6a7-ebe68cc87cdc?quicklink=index&overridelayout=true
Regards
KP

Similar Messages

  • Calculating the number of days based on transaction in Query

    Hi friends,
    I would be greatful if u can help me out. I have got a situtation where in i need to take the day when the transaction has occured otherwise i dont need to take that day. For example if one transaction occurs on 1st , i need to take that day and if the transaction dosent occur then i need to ignore it. If there is one transaction or multiple transactions i need to take the day only once.
    Like transaction has happened on 1st Jan so it will be considered,
    on 2nd the transaction dosent happen so i need to ignore it
      on 3rd there is a transaction so its taken.
    So its like 1st - 1
                   2nd - 0
                   3rd - 1
    So total will be 2.
    Transactions are being taken from a cube. Kindly let me know as to how to do this in query.
    Thanks,
    Kapil

    PLease give us some more inputs.. requirement is not clear.
    Do u have 0calday in ur Cube?
    Khaja

  • How to automatically update the Expiry Date's number of days

    My web app input form is an event submission form. Users enter the event title, event date and other details, etc. I've figured out how to get the "expiry days" in the form and it be hidden but i can't figure out how to calculate this:
    (today's date) - (event date) + 1 day = number of days to expire and then set the expiry days to that value upon submission.
    I have tried writing the js but am getting no where, has anyone out there already accomplished this? I've researched and researched and find a million things on calculating the number of days but can't get one of them to work for my situation here... any help would be greatly appreciated!!

    Hi Murtuza,
    You can use function module BAPI_ISUACCOUNT_CHANGE.
    Pass dunning lock details in parameter TCTRACLOCKDETAIL. This function module only create and delete locks.
    So, you need to pass existing lock details (from table DFKKLOCKS) with PROCESSING_MODE = 04 (delete) and append another value with changed expiry date with PROCESSING_MODE = 01 (Create).
    This will also help in maintain lock history too.
    Hope this helps.
    Regards,
    Avinash

  • MDX- Getting Number of days in a selected period

    HI All,
    I need a help in MDX.
    Here I am calculating the number of days in a selected time period.
    In my date dimension we have the Month as the last level.
    But somehow I bring a column called "Days in Month" 
    Now my Date dimension table is like below:
    Id   year  Month
    DaysInMonth
    1 2014
    Jan 31
    2  2014
    Feb 28
    12  2014
    Dec 31         and so on.....
    So i created a hierarchy which contains three levels i.e. Year--->Month---->---->DaysInMonth
    Now I want to know the Total number of days in a selected time period.
    i.e. if I select 2014 then it should show 365, similarly if i select
    Aug-2014 then it should show 31.
    I have tried the below code i.e. 
    WITH MEMBER measures.X AS
          count( DESCENDANTS (
                [Time Accounting period].[Hierarchy].CURRENTMEMBER,
                [Time Accounting period].[Hierarchy].[Days In Month]))
    SELECT Measures.X ON 0,
    [Time Accounting period].[Hierarchy].[Year].&[2013] on 1 
    FROM [XXX]
    Here it is showing me the total members in that particular level,
    E.g. When I am selecting 2013, its showing me 12
    If I select Jan-2013, its showing me 1
    But I dont want this, if I would have the Dates in my Date Dimension, then this code would have worked perfectly.
    So i just want to know if somehow we can use the DaysInMonth
    column to accomplish this.
    Thanks
    Sudipta Ghosh
    Sudipta Ghosh Tata Consultancy Services

    HI David,
    If I would have the Day level data then my below code will give me the desired result.
    WITH MEMBER measures.X AS
          count( DESCENDANTS (
                [Time Accounting
    period].[Hierarchy].CURRENTMEMBER,
                [Time Accounting
    period].[Hierarchy].[Days]))
    SELECT Measures.X ON 0,
    [Time Accounting period].[Hierarchy].[Year].&[2013]
    on 1 
    FROM [XXX]
    But unfortunately I don't have the Day level in the dimension, So was wondering whether we can use the
    DaysInMonth column by any means.. :(
    Sudipta Ghosh Tata Consultancy Services

  • User Exit Variable for Calculating number of days in a month

    I need a query to calulate the number of days in a particular month upto the current date. For example if i give 26 Feb it should reutrn 25, if i enter 30march it should return 29 for any specific year. I have gone through some posts and understood that i need to create a formula variable (under calculated KF's) and then go to CMOD, create a project, then enancement Assignment RSAP0001 then EXIT_SAPLRSAP_001 and include a code in INCLUDE ZXRSAU01. But i have any clue of coding. Could someone give me the entire code and how to connect it to the formula variable KF in created. The technical name of the key figure is ZMDAYS. If i have made any mistakes or if there is another eaier alternative please let me know. I thankyou all for the help.

    Hi Uday,
    I have a few modifications in the code
    Data: xdate type d,
          ip_year(4) type N,
          ip_month(2) type N.
    Types : Begin of ty_month_days,
           month(2) type N,
           days(2) type N,
           End of ty_month_days.
    Data : it_month_days type ty_month_days occurs 0 with header line.
    ip_year = 2006.
    ip_month = 01.
    do 12 times.
        CONCATENATE ip_year ip_month '01' INTO xdate.
        xdate = xdate + 33.       "this date is in the next month
        xdate+6(2) = '01'.        "first day of next month
        xdate = xdate - 1.        "last day of xmonth
        it_month_days-month = xdate+4(2).       "number of days of xmonth.
        it_month_days-days = xdate+6(2).
        append it_month_days.
        ip_month = ip_month + 1.
    enddo.
    This code stores Month and No. of days in the internal table it_month_days.
    You can access this internal table for your calculations
    This should help.
    Regards,
    Praveen.
    Message was edited by: praveen mathew

  • Calculated item divided by number of days in a month

    Hello.
    I'm trying to create a calculated item, that is supposed to represent a column member, divided by the number of days in a month that's selected from the dashboard prompt.
    I know that I need an SQL function to get the number of days, but I don't think that you can use SQL functions when creating calculated items.
    Is there a way to do this?

    Looks like you are thinking too much
    Use expression builder in the rpd and then just use available functions without 2nd thought.
    if helps mark

  • Calculating the next meeting date and the number of days until that

    Hi all,
    I created a meeting log page and I made a query that returns the most recent meeting date:
    to_char("MFR_MEETING_LOG_MAIN"."ML_MEETING_DATE",'MM/DD/YYYY')
    What I want to do is to calculate the next meeting date which is 6 month after the most recent meeting and the number of days until the next meeting.
    How do I do that? THank you very much for the help in advance!

    Basic SQL:
    Datetime/Interval Arithmetic.
    ADD_MONTHS function.
    If you're new to Oracle and SQL it may be advisable at this point to complete the Database 2 Day Developer's Guide.

  • Calculating number of days without weekend and holidays

    Hallo all,
    can someone help me with a formular to calculate the number of days with Crystal Reports 2008 between two dates without weekends and holidays
    eg.
    date one = 03/24/2010
    date two = 03/29/2010
    Result should be 4 days as 03/27 and 03/28 will be a weekend.
    Plus how to exclude holidays ?
    Thank you very much
    Gerald

    As Doug mentioned, Holidays are very location specific, and are you talking about "corporate holidays" where the company is closed, or "public holidays" where banks (<g>) are closed?
    I'd suggest setting up a calendar table (if you don't have one already), one record per date.  You could make it work-days only, days-off only, or all dates with a flag to indicate if it is a work date.  You could then use that to count the number of work days.  By using a table, you wouldn't have to change any code to (a) extend your calendar to the following year, or (b) change holiday dates if the holidays change.  (I'm thinking corporate holidays, where the company might be closed Friday 12/24/10 in observation of Christmas, but would usually only close on the 25th.)
    HTH,
    Carl

  • How to avoid crosstab - Show number of days according to groups

    Morning all,
    I think you all would agree with me that even having crosstab as a great tool in Crystal 2008, there are still quite allot of limitations to it.
    I have created a report using crosstab which shows number of days and jobs according to those days grouped by account number, product code, sales area. This report is working fine until my director asked me to further group those days according to sub categories of lenses.
    For example
    Crosstab shows
    Number of days - Day 1,day 2, day 3
    Number of jobs - 111----123--1213
    Percentage - -
    12%---34% 60%
    Now if you look at the example it says day 1, 111 jobs went out. What the director would like to see is those jobs being sub divided into types of lenses.
    So out of 111 jobs, 25 would be Finished lenses, 30 could be uncut lenses and so on.
    The new report should be like this
    Number of days -
    Day1---Day2---Day3
    Number of Jobs:-
    Finished -
    25--34-----23
    Uncut--3045-----23
    AR--7056-----76
    Total----125135----122
    Percentage:-
    Finished -
    25%--34%-----23%
    Uncut--30%45%-----23%
    AR--70%56%-----76%
    Total----100%100%----100%
    Now if we look at the above criteria it seems that I have to use groups even further down the report where I am using crosstab at the moment. This means I have to get rid of the crosstab and run a report manually.
    However the big question is, how to get the report calculating number of days and jobs according to customer account number, product code and sales area manually?
    I tried the following formula but this requires to write way too many formulas, for example some of the jobs have taken more than 60 days and if i use this formula I have to write 60 formulas for number of days which is not feasable.
    **//provided by IIbas in another forum**
    whileprintingrecords;
    numbervar day0;
    numbervar day1;
    numbervar day2;
    if {@workingdays} = 0 then
    day0 := day0 + 1 else
    if {@workingdays} = 1 then
    day1 := day1 + 1 else
    if {@workingdays} = 2 then
    day2 := day2 + 1 else //up to the maximum number of days.
    Then in the report footer, reference the days in separate formulas, and identify them with text boxes, e.g.,
    //{@day0};
    whileprintingrecords;
    numbervar day0;
    I can sort out the Finished, uncut,AR by grouping them however I am wondering how to create a manual running total of jobs complying with number of days without using crosstab.
    Any ideas?
    Many thanks
    Regards
    Jehanzeb

    no answer closing

  • How to get "Number of days" in a report on 0PM_DS02

    Dear BI Gurus,
    I need to build  a query on the PM DSO - 0PM_DS02 (MTTR/MTBR).
    The query has 0Equipment in the rows
    The fields Available Time | Breakdown TIme | Utilised Time in the columns for the time granularity selected.
    The field Breakdown Time is the calcaulted key figure Actual Outage Time from the DSO.
    The field Utilised Time  is a formula = Available Time - Breakdown Time.
    The issue I am facing is regarding the field Available Time.
    In the report the user needs time granularity in Month and Year.
    Basically the logic for the field Available Time = Number of days in the time period selected * 24
    where 24 = number of hours in a day.
    Now my issue is when the time granularity is month , the field should have the number of days in the month the user selects from the selection screen and when the time granularity is year, the field should have number of days in that year.
    Also during the query execution period, when the user changes the time granularity the report should also change the calculation for this field.
    (I can bring an extra field to the DSO, which will bring the available number of days in a month for each record)
    Can you please guide me how to map this scenario.
    Many Thanks in Advance,
    With Warm Regards,
    Vineeth

    Hi All,
    Waiting for your suggestion on this?
    With Warm Regards,
    Vineeth

  • How to get the number of days

    hai bloggers,
    see we have 365 days per year for first half we are going to have 180+ days (if we select first half as the prompt and we select week number as prompt and the last date of that particular week should show in the report)and number of days upto that date or week also should display...if we select second half and week number of that particular half it should show number of days upto that week and highest date of that week number of days should count from 1 to 180+ only mean (july 1 st is 1 st day)
    thanks

    You need to use timestampdiff function for calculating number of days. One of the way to calculate is like this
    case when "Time"."Calendar Half Year" = 1 then timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-01'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),CAST(EVALUATE('TO_DATE(%1,%2)','30-06'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE)) else timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-07'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),CAST(EVALUATE('TO_DATE(%1,%2)','31-12'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE)) end
    If you want calculate between 1st day of the half and last date of a week then use following
    case when "Time"."Calendar Half Year" = 1 then timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-01'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),MAX(MAX("Time"."Calendar Date"))) else timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-07'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),MAX(MAX("Time"."Calendar Date"))) end
    Hope it will answer your question
    Thanks,
    Phani.

  • How to get planned % complete based on number of days

    Hello:
    I a trying to figure out a way(best way) to determine a "planned % complete" simply based on the number of days in a task.
    For example:
    Task Start Date = 3/1/15
    Task Finish Date = 3/20/15
    So the task is 20 days long
    Today is 3/10/15 so "planned % complete" should be 50%
    (Today-Start) / (Finish-Start)
    =
    ((3/10/15)-(3/1/15)) / ((3/20/15)-(3/1/15))
    =
    (10) / (20)
    =
    50%
    Do I just enter this into a custom field as a formula or is there a better way of doing this?
    Also, when I tried to do this with a formula, it did not apply to the roll up tasks. So, the bolded tasks were blank.
    I am trying to get to a calculated number of the % I should be completed based on the current date and length of the task. I realize this might not be the best way so any
    suggestions are greatly appreciated.
    I would like to be able to look at my project and see that I am 35% complete, but I should be 50%.
    Any guidance is greatly appreciated.
    I am using MS Project 2010.
    Thanks
    kp

    Hi kp,
    You are typically asking for Earned Value indicators. You could of course use the kind of formula you are refering to, but have in mind that MS Project proposes by default a large number of EV fields, such as CPI, SPI and all variance fields. Although it
    requires a certain maturity in scheduling (cost, baselines, status date, tracking), it will provide you a large set of EV indicators out of the box.
    See an excellent article
    here.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Current Date plus number of days script

    Hi All,
    I have a form I am building which has a date field (currently setup to specifiy todays date on load).  There is a field that slects number of days until a billing cycle (currently 0 through 13 days).
    I need to setup a script that takes todays date, adds the number of days from the 0-13 result and gives a result of a date (0-13 days from today for example).
    Any thoughts on how I might do this?  Very new to JS.
    Thanks for any help you may be able to provide.
    Ant

    here is an example of what I have used:
    var f = this.getField("BILLINGCYCLEDATE");
    var g1 = this.getField("DAYS");
    var g = g1.value
    var today = new Date();
    var add = d1.valueOf();
    add +=1000 * 60 * 60 * 24 * g; 
    var future = new Date(add);
    f.value = util.printd("mm/dd/yyy", future);
    You would want to set this up as a calculation in your BILLINGCYCLEDATE field.  The field DAYS is whatever you have set up as the 0-13 counter.  I set up a simple text box where you input a number.  The field will then calculate X number of days out.   Hope this helps.

  • Determine the number of days in a False period in a Temporal Boolean

    Hi all,
    I need to determiine the number of days based on a condition that lies on the gaps between the periods.
    My input consists of multiple periods. The length of the gap is the condition to determine the start date for summation. However, there can be multimple gaps between my instances that satisfy this condition and I need the last one that satisfies it.
    For example:
    period 1: 1-1-1990 until 31-12-1992
    period 2: 1-1-1994 until 31-12-1996
    period 3: 1-1-1998 until 31-12-1999
    period 4: 1-6-2000 until 31-12-2009
    The condition for the start date is the last gap greater than 1 year. In this example, the start date should be the start date of period 3: 1-1-1998, because this is the period after the last gap >= 1 year. Period 2 also has a previous gap of >= 1 year, but this period should NOT be selected.
    My first idea was to use a TBR function: to determine relevant periods (based on the gaps before and after), calculate the amount of days per relevant period and add those up. However, if I want to do that I need to calculate the number of days in the gaps and I don't see how to do that, since I cannot determine a day difference across periods (end date period 1 until start date period 2).
    Any help/ other solution ideas?
    Kind regards, Els

    This was an interesting puzzle which you can solve from a couple of different angles.
    Firstly, you can use inferred relationships to infer a relationship "the following periods" (ie. the periods that follow the current one). My rules looked like this:
    the period (the other period) is a member of the following periods if
       the other period start date > the period start date
    the period’s next start date = InstanceMinimum(the following periods, the period start date)From here it should be easy to see if there was a gap of more than a year, and find the most recent period after a year-long gap. Of course you need to deal with the situation of the last period, when there is no 'next' period, presumably you would use the date of assessment in that case, but I'll leave that as an exercise for the reader.
    A completely different way of doing it is to use the TemporalConsecutiveDays function to find a date where a gap of 365 days exists, then select periods in which there is a gap immediately before the start of that period. Here are some rules that :
    there is a period that applies if
       ExistsScope(the periods)
          TemporalOnOrAfter(the period start date) and
          TemporalOnOrBefore(the period end date)
    there is a year-long gap if
       TemporalConsecutiveDays(365, 365, there is not a period that applies)
    the period starts after a year-long gap if
       ValueAt(the period start date, there is a year-long gap)
    the start date for calculation = InstanceMaximumIf(the periods, the period start date, the period starts after a year-long gap)Hopefully one of these is suitable for your needs.
    cheers,
    Steve.

  • Field in Material Master to specify the number of Days to keep the stock

    Dear Gurus,
    I want to define in Material Master, that i want to keep the Stock of the Material of 4 days as Safety stock, My consumption of Material can vary from month to month low or high. But i want to keep the number of Days fixed in Material Master for the Safety Stock. So that if my consumption varies, my Stock Quantity for Safety automatically updated.
    Regards,
    Johi Kapoor

    Hi,
    Check the TAB safety time/act. cover {Screen field MARC-SHZET, Field selection group-57} in MRP-2 screen in net requirement calculation segment.
    Regards,
    Biju K

Maybe you are looking for

  • No Adobe Form Is Assigned to the Scenario -ERROR

    Hi All, I configured the ADS server and was able to display the test Adobe Forms and test the forms successfully in ECC and Portal side. (We are using ERP 2005 and EP 7.0 of NW2004s) However when I tried to test the PCR forms in MSS, I get the follow

  • Sort all folders in the same way

    I understand how I can sort messages in a folder, but I would like to apply this selection to all my many many folders at once - and ideally also have it as the default for the future. (I always use the latest tb version in a linux environment)

  • 3rd party software for syncing media to blackberry phones

    Not spam. I wanna say that right out front. I'm not trying to sell anything but I do have an app that can add a lot of value to windows users who need to sync Android G1's, Blackberry's, a PSP, iPhones, iPods and dang near any device.This is somethin

  • Oracle 10g - AMD cpu

    Will oracle 10g under windows 2000, run on an amd box?

  • IBAN cannot be generated -- Message no. BF00012

    Hi experts I have a problem. Normally when i run the transaction PA30, i add the bank details and the system generate the IBAN automatic. and if i go to the transaction FK01 i add the IBAn and the system generate the bank details automatic. My proble