Date diff
Hi,
I went through a lot of date related post and was able to write a script(with alps help-Re: Days behaviour between two dates Now iam using 11.1.2.1 planning on top of essbase. While my end date is saved as a sub var with value 20131231. the beginning date is a user input in data forms in planning. I used the member that hold this date value in the script but it doesnt do the calculation. No value is getting populated as output. the script is working , as ive tested it with two sub vars instead of user input.
But i came across posts that spoke about difference in format that dates gets saved for essbase and planning. the date that i enter in planning reflects as "2.0130405E7" in essbase when i retrieve .
Please do help.
thanks
Hi Alp,
Am sorry for replying late. Here s waht my situation. The Year end date wd be saved as subvar in essbase, value =20131231. Project end date would be a date value fed from planning data forms to a account member of type date. Ive took help from one of your post and just inputted my values as you can see below.
var y1, y2, m1, m2, d1, d2, difx1, difx2,diff,a,b,x;
SET CREATENONMISSINGBLK ON;
SET CACHE HIGH;
Fix(&Curr_Year,"Actual","HSP_InputValue","No Employee","No Product","1st Pass","GL_Load","No Line Item","No Asset","No_Custom1","Jan")
Fix("50")
FIX("01-03-390")
"Depreciation-IT HW"
y1=@ROUND("Project End Date"/10000,0);
y2=@ROUND(&YearEnd/10000,0);
m1=@ROUND(("Project End Date"-y1*10000)/100,0);
m2=@ROUND((&YearEnd-y2*10000)/100,0);
d1="Project End Date"-(y1*10000+m1*100);
d2=&YearEnd-(y2*10000+m2*100);
difx1=@TODATEEX("mm/dd/yyyy",@JconcatStrings(@LIST(@JgetStringFromDouble(m2),"/",@JgetStringFromDouble(d2),"/",@JgetStringFromDouble(y2))));
difx2=@TODATEEX("mm/dd/yyyy",@JconcatStrings(@LIST(@JgetStringFromDouble(m1),"/",@JgetStringFromDouble(d1),"/",@JgetStringFromDouble(y1))));
diff=@datediff(difx2,difx1,DP_DAY);
"Depreciation-IT HW"=@ROUND(diff*("165012"/1095),0);
"Total Budget required"
"Total Budget required"="Fit Out Cost"+"165012"+"165007"+"165017";
endfix;
endfix;
endfix;
The rule started working fine, for dates i inputed through the data form, taking value of Project End date. But since it was just under testing i had Fixed it for Jan alone. Then when i included other months it started to fail saying Error in date formatting. And then a few times i went back and saw the rule run for Jan but later it stopped for all.
the value of project end date gets saved in essbase as 2.0130131E7. But in planning when i check for raw data it shows 20130131, so i thought the rule was logically fine.
please do direct me in the right way.
thanks,
Similar Messages
-
1. Subscriber – Employee Details has these three records
2. Call Details has these two records
My main goal is to populate date diff in table 1 as 1 if "work order check in date" >= 3 of Aspect calender date from the 2nd table.
The Problem i am facing is that the date diff in table 1 does not populate. I have come to an understanding that the issue is because of many t many relationship between table 1 and table 2. Is there a way to work around this?
Date Diff formula - If(DaysBetween([Work Order Check In Date];[Base2]) >=3 ;1;0)Hi Akshay
Did you try removing If condition and able to see the date difference result,if so is it working fine or not? If it is working fine use this result and define another variable for If-else and validate the condition
Regards
Bose -
I want to calculate the date diff for delivery date(eg;-sep-24 ,2007) and scheduled date(eg:-sep-17,2007)there the result should be 7 but i dont no how to write query can we use routines in this kind of situations...
hai
use replacement path for both dates and create a new formula by subtracting from(delivery date -scheduled date)
below is the best example
http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
chk these links would help u more,
http://help.sap.com/saphelp_nw04/helpdata/en/3f/89533e5ff4d064e10000000a114084/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2c/78a03c1178ad2ce10000000a114084/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/af/809528939d5b4fbff7e16a5bdc0d85/content.htm
http://help.sap.com/search/highlightContent.jsp
http://help.sap.com/saphelp_nw04s/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm -
Hi, The requirement is to calculate the diff between 2 date fields and display it. I could able to get the difference between the 2 date fields. But now the result column SHOULD DISPLAY the result ONLY if the 2 date fields have the date set ELSE it should be left blank(basically NULL shud be set to the result column in such cases).
The formula which I have used to get the result is :
(NOERR(date1)<>0 AND NOERR(date2)<>0)*(date1-date2).
The above formula works fine and gives the result as desired except that it puts "0" even though the date fields doenst have a value.I have tried to use the ELSE part by giving "1/0" thinking it wud give me "#" but this didnt help me out anyway.
Any inputs on this...Thanks for the response.
That was an option which I also thought of and I wud use it only as a last rescue and trying if I can get some info to do it otherwise.
The other option which I have in my mind is to just get this diff into the cube and this shud resolve but then again I hv to chg the BW structures and unnecessarily I wud be increasing the load to the cube.
Any other option in Bex ...??? -
Hi friends,
I'm having doubt in time diff. Just assume this scenario.
Today is sunday and 13 hrs. I just want to know the difference between this and coming wednesday 01 hrs. But i don't know the date for coming wednesday. Is there any function available which returns the date for this coming wednesday. And i don't want to add 3 to the DAY_OF_MONTH part.Today is sunday and 13 hrs. I just want to know the
difference between this and coming wednesday 01 hrs.
But i don't know the date for coming wednesday. Is
there any function available which returns the date
for this coming wednesday. And i don't want to add 3
to the DAY_OF_MONTH part.Your loose specification makes it difficult to be sure what you want but try this.
public static void main(String[] args)
// Now
GregorianCalendar calendar = new GregorianCalendar();
long nowInMilliseconds = calendar.getTime().getTime();
// Move on to next wednesday
while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.WEDNESDAY)
calendar.add(Calendar.DAY_OF_YEAR, 1);
// Set to 1 am
calendar.set(Calendar.HOUR_OF_DAY, 1);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
// Difference in ms
long betweenNowAndNextWednesday = calendar.getTime().getTime() - nowInMilliseconds;
System.out.println(betweenNowAndNextWednesday + " " + calendar.getTime());
}It should not be too dififcult to generalise it! -
Need MDX query to find something like date diff and Date Range for last 10 days
Hi ,
I need two Query .First Query for below;
I have below data in table like.
Cat StartDate EndDate
A 2000-01-01 2000-01-15
B 2000-01-02 2000-01-30
C 2000-01-01 2000-01-31
D 2000-02-01 2000-02-28
A 2000-01-10 2000-01-31
I need if Startdate and Date completes whole one month then set status =1 else 0 using MDX query.
like this ;
Cat StartDate EndDate Status
A 2000-01-01 2000-01-15 1
B 2000-01-02 2000-01-30 0
C 2000-01-01 2000-01-31 1
D 2000-02-01 2000-02-28 1
A 2000-01-10 2000-01-31 1
In second query I need last 10 days from current days like;
Now = 8/20/2014
output will be ;
8/20/2014
8/19/2014
8/18/2014
8/17/2014
8/16/2014
8/15/2014
8/14/2014
8/13/2014
8/12/2014
8/11/2014
8/10/2014
Please help me .
ThanksHi Prajapati,
In your scenario, you can use Properties and Datediff function to achieve your requirement. Since not know the structure of your cube, we cannot give you the esact query.
I have tested it on the AdventureWorks cube, the query below is for you reference.
WITH MEMBER [Measures].[StartDate]
AS
[Employee].[Employee Department].CURRENTMEMBER.PROPERTIES('Start Date')
MEMBER [Measures].[WorkYear]
AS
DATEDIFF('yyyy',[Measures].[StartDate],NOW())
MEMBER [Measures].[Status]
AS
IIF(DATEDIFF('yyyy',[Measures].[StartDate],NOW())>10,1,0)
SELECT {[Measures].[StartDate],[Measures].[WorkYear],[Measures].[Status]} ON 0,
[Employee].[Employee Department].[Employee].MEMBERS ON 1
FROM [Adventure Works]
Results
Reference
http://msdn.microsoft.com/en-us/library/ms144821.aspx
Regards,
Charlie Liao
TechNet Community Support -
Hi,
how can i calculate date difference in hours from 2 dates(timestamp) in obiee
i.e. 02/03/1986:08:00 and 03/02/1986:0:14:00Hi,
If you are having two date column and want the difference in hours then try with the below function:
timestampdiff(SQL_TSI_HOUR, date_column1, Date_Colum2)
or if you are having two date value in the expression itself then go with the below syntax:
timestampdiff(SQL_TSI_HOUR, TIMESTAMP'1998/07/31 23:35:00', TIMESTAMP'2000/04/01 14:24:00')
Hope it helps,
Regards,
Bose
Edited by: Bose on Mar 20, 2012 3:33 PM
Edited by: Bose on Mar 20, 2012 3:38 PM -
Hi, I need to get the difference between two dates (in days) in a calculated field, can anyone help me?
Best Regards(Date1-Date2)/86400 should give you the time difference in days. 86400 is the number of seconds in 1 day.
-
Date Diff In a BETWEEN Gives a 00932?
Good morning. This seems like a simple problem, but I can't find a solution in the forum or on Google. Can some wise Oracle SQL guru point me in the right direction?
This is what I'm trying to do:
...X BETWEEN '01-JUN-2006' AND ('30-NOV-2009' - 162)...but this gives an ORA-00932 error, inconsistent datatypes: expected DATE got NUMBER. I don't understand this; adding or subtracting an integer from a date shouldn't change its type, and doesn't seem to in other circumstances. I tried this next:
...X BETWEEN '01-JUN-2006' AND ('30-NOV-2009' - INTERVAL '162' DAY(3))I can't say I'm impressed with the implementation of intervals. The number has to be formatted as a string? The default precision is 2?? Anyway, this errors with ORA-30081, invalid data type for datetime/interval arithmetic. This error seems to be very elusive, none of a dozen sites gave any helpful info, and this very forum claims to have no topics with "30081".
In other databases I could use something like this:
...X BETWEEN '01-JUN-2006' AND DATEADD('d', '30-NOV-2009', -162))...but I can't find such a function.
I could calculate the net value of the second date before passing it to the query, but that really shouldn't be necessary. This isn't complicated! Any ideas? I'm running on Oracle 9.2, if it matters.
- JHi,
Don't forget that all DATEs include hours, minutes and seconds. When debugging a problem with DATEs you should always display them.
ALTER SESSION NLS_DATE_FORMAT = 'DD-Mon-YYYY HH24:MI:SS';will make the default display include hours, minutes and seconds.
If you don't specify hours, minutes or seconds, they default to 0.
Why is this important?
Say you want to find orders placed between February 4 and 6 (inclusive) this year.
A common mistake is to say:
WHERE order_date BETWEEN TO_DATE ('04-Feb-2009', 'DD-Mon-YYYY')
AND TO_DATE ('06-Feb-2009', 'DD-Mon-YYYY')Knowing that "x BETWEEN y AND z" returns TRUE when x=y or x=z you might think the expression above includes February 6. Actually, it only include the first second of February 6, and excludes the other 83,999 seconds.
That is, the expression above is equivalent to:
WHERE order_date BETWEEN TO_DATE ('04-Feb-2009 00:00:00', 'DD-Mon-YYYY HH24:MI:SS')
AND TO_DATE ('06-Feb-2009 00:00:00', 'DD-Mon-YYYY HH24:MI:SS')To include orders placed at any time on February 6, you can say:
WHERE order_date BETWEEN TO_DATE ('04-Feb-2009 00:00:00', 'DD-Mon-YYYY HH24:MI:SS')
AND TO_DATE ('06-Feb-2009 23:59:59', 'DD-Mon-YYYY HH24:MI:SS')or add 1 day to the end date, and do not include that point. This last technique is often used with parameters, for example:
WHERE order_date >= TO_DATE (:from_date, 'DD-Mon-YYYY')
AND order_date < TO_DATE (:to_date, 'DD-Mon-YYYY') + 1 -
Convention for date diffs?
I run into this problem again and again with date functions
that use Now(). In this case, I just want to compare today's actual
date with another date, and determine the numbers of days
difference, not counting the time of day. But if I use
datediff(Now(), 'May 25, 2006'), it returns 0, because there isn't
a full day's difference between May 24, 2006 12:30 PM and May 25,
2006 12:00 AM (May 25 being tomorrow). What I want to see is "1".
I've always used Now()-1 to compensate for this, but that
doesn't seem very elegant. Is there a simply way to code "return
the difference between today's date and another date, without the
time of day being factored in?"JMGibson3 wrote:
> How bout simply dropping time out of the equation
altogether(my session var was already date only):
>
> <cfif
DateDiff("d",DateFormat(Now(),"MM/DD/YYYY"),Session.SelThruDate) GT
7>
or you could use cf epoch offset (days since 31-dec-1899):
<cfif int(Session.SelThruDate) - int(now()) GT 7> -
How to calculate two date diff?
what is the similar function in BIEE? like datediff = date1 - date2 SQL statment in Oracle db,
i have tried to use minus, it was not works, BIEE does not support minus two date directly?
thanks a lot!
Kaymoyou can use timestampdiff function. The TimestampDiff function returns the total number of specified intervals between two timestamps.
Syntax:
TimestampDiff (interval, timestamp-expression1, timestamp-expression2)
example TimestampDiff (SQL_TSI_DAY, date1, date2) returns the number of days between date1 and date2.
The specified interval. Valid values are:
SQL_TSI_SECOND
SQL_TSI_MINUTE
SQL_TSI_HOUR
SQL_TSI_DAY
SQL_TSI_WEEK
SQL_TSI_MONTH
SQL_TSI_QUARTER
SQL_TSI_YEAR -
Anyone know of a good DATA diff tool? assume schemas are the same...
Hi,
I was wondering if anyone has used or come across any tools that compare data across schemas. We can assume the table structures in 2 schemas are identical and we just want to detect data diffrences between them.
I can think of a way to do this with some PL/SQL but thought the problem was common enough that a tool might already be available.
Oh - and I need to wrap processing around this so it would need some sort of API (i.e. I'm not looking for a GUI)
Thanks!
Message was edited by:
ennisb
Message was edited by:
ennisbThanks.
I'm on 10G and this looks to be an 11G tool?
But this comment made me unsure...
Can be used to compare tables, views, and materialized views backward compatible to 10gR1 due to need for ORA_HASH. -
IPhoto application and camera Date differ!
Lately many photos I import from my digital camera come up wrong in the iPhoto application.
My camera (Cannon PowerShot A590) shows the right date, but iPhoto sets the "roll" date as :
14/1/ 2008 to 21/31/2008
One of these photos date shows as 21/21/2008
I didn't notice this until I imported a roll, and tried to change it in the information box for each photo, but the date I typed in didn't save and reverted to the 21/21/2008.
I can not find any place in the iPhoto "help" to correct this date problem. I can not change the date when I am trying to import a roll.
What gives, how did this happen, since there is NO month of 14 or 21 ???
Please advise quickly, thanks.Daniel:
If you want to correct the date in the file itself, thus allowing other applications to have and use the correct date, then you'll have to export those files to a folder on the desktop and batch change the EXIF date with PhotoInfo. You can then import them again into iPhoto and delete those with the incorrect date. This will not create a compressed file as all you're doing is copying the file to the desktop, editing the date field and then copying back to iPhoto.
Do you Twango?
TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
I've written an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file. -
Gaussian Peak Fit and Nonlinear Curve Fit on small data differ from Origin Peak fit
Hi all,
I am developing a program in which I have to fit Gaussian curve on only 4 or 5 data points. When I am using Gaussian Peak Fit or Nonlinear Curve fit, it linearly connects all the points while other fitting software like Origin is fitting Gaussian curve on the same set of data I have attached two images One is from Labview with Gaussian Peak Fit and NonLinear Fit and other is from Origin.
Data is
X Y
799.09857 257
912.25256 641
1026.00366 1516
1137.92871 1118
1253.43713 329
Labview user
Solved!
Go to Solution.
Attachments:
Origin_Fit.PNG 21 KB
Labview_fit.PNG 15 KBThat looks like a plot of the input data.
When I run it with your data I get a Gaussian curve which looks much like your Origin plot.
The Plot 2 curve is from 128 points equally spaced along X and Y calculated from the Gaussian formula in the LV help using the output parameters from the fit. Plot 1 is the Best Gaussian Fit output from the fit VI. It only has five points.
I used default values for everything except X and Y.
Lynn -
Hi,
I'm writing a java app which is connected to a ms access db. I have the following query, but i get a run time error that states "too few parameters expected 1". I think the problem lies with the DateDiff part of the query, i want it to calculate the date difference in hours rounded to two decimal places, below is my code:
String query = "SELECT Session_Enrolment.employee_id, Session_Enrolment.course_id, Course.course_name, Session_Enrolment.session_id, Training_Session.date, DateDiff(hh, Training_Session.start_time, Training_Session.finish_time)/60 AS Hrs_Completed " +
"FROM Employee INNER JOIN ((Course INNER JOIN Training_Session ON Course.course_id = Training_Session.course_id) INNER JOIN Session_Enrolment ON (Training_Session.session_id = Session_Enrolment.session_id) AND (Course.course_id = Session_Enrolment.course_id)) ON Employee.emp_id = Session_Enrolment.employee_id";Your help would be appreciated greatly
Simon.I've manage to get the query to work to some degree, but when i do
resultSet.getString("Hrs_Completed");i've tried using resultSet.getDate, resultSet.getInt. Northing works.
I get an error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Invalid procedure call
Help required urgently!!!!!!!!!!!!!!!!!!!! PLEASE
Thanks.
Simon
Maybe you are looking for
-
Bad internet service and bad landline
I am having horrible internet problems and landline issues. What can they do? They promised it would work had at Least 7 repair people here already? Why are they promising service when they can't keep it going?
-
BB line speed is now half the speed since moving t...
I would like to know why the line speed is now 0.77MB when it was more than 1.7MB when I started with BT. We used to be able to watch films on ipad without problems but now this is not possible unless you want ro watch it minimised which is not accep
-
Restrict GET/POST to a single servlet
I've seen what looked like this question asked several times on this newsgroup, but nothing seems to match what I'm looking for. So I apologize if it has been asked and answered. Basically, I want to deploy a war file such that my front controller se
-
I want to get a radio control airplane simulator, but there are none avalable for Macs. Would appreciate hearing from anyone who has windows running on his/her iMac.
-
I am giving my iPad to a friend. How do I deregister it so that she can sync it to her own computer?