Current_date -60
Hi guys,
I would like to write following report, but instead of day between '....' and '....', which would reduce to report to use a fix period, I would like to use a period where I show each day from current_date -60.
How do I write this function?
Thanks
G.
SELECT "DS Resort".Resort saw_0, "DS Time"."Date Order" saw_1, "DS Time".Day saw_2, DAYNAME(Time.Day) saw_3, DAYOFWEEK(Time.Day) saw_4, "DS Non Revenue Facts"."Occ Room" saw_5, "DS Non Revenue Facts"."Occ Next 7 days"/7 saw_6, "DS Non Revenue Facts"."Occ Next 31 Days"/31 saw_7, "DS Non Revenue Facts"."Occ Next 365 Days"/365 saw_8, "DS Non Revenue Facts"."OCC Room %" saw_9, "DS Non Revenue Facts"."OCC Next 7 Days %" saw_10, "DS Non Revenue Facts"."OCC Next 31 Days %" saw_11, "DS Non Revenue Facts"."OCC Next 365 Room %" saw_12 FROM "DAILY SUMMARY" WHERE ("DS Time".Day BETWEEN date '2008-07-22' AND date '2009-09-22') ORDER BY saw_1
I made report with columns:
TIMES.TIME_ID
SALES.QUANTITY_SOLD
and filter in TIMES.TIME_ID column with (advanced option, convert this filter to SQL):
TIMES.TIME_ID BETWEEN CURRENT_DATE-60 and CURRENT_DATE
And this works fine and the query is:
select T20553.TIME_ID as c1,
sum(T20550.QUANTITY_SOLD) as c2
from
TIMES T20553,
SALES T20550
where ( T20550.TIME_ID = T20553.TIME_ID and T20550.TIME_ID between TO_DATE('2009-09-22' , 'YYYY-MM-DD') - 60 and TO_DATE('2009-09-22' , 'YYYY-MM-DD') and T20553.TIME_ID between TO_DATE('2009-09-22' , 'YYYY-MM-DD') - 60 and TO_DATE('2009-09-22' , 'YYYY-MM-DD') )
group by T20553.TIME_ID
order by c1
Pay attention to your date format.
And note that CURRENT_DATE-60 works in the Answers filter but if you put the same in edit column formula you'll get error:
An arithmetic operation is being carried out on a non-numeric type
So leave it just in the filter.
Regards
Goran
http://108obiee.blogspot.com
Similar Messages
-
OBIEE -- How to create a filter between current_date and 31 days pass
Hello guys
I was trying to put a filter on the date column and filter between timestampadd(sql_tsi_day,-31,current_date) and current_date
I was successfully able to define both field on sql expression of the filter and I selected "is between"
when I put this date column with measures and other columns then run report, I get a different error:
State: HY000. Code: 10058. NQODBC SQL_STATE: HY000 nQSError: 10058 A general error has occurred. nQSError: 42043 An external aggregate is found in an outer query block. (HY000)
SQL Issued: SELECT Product."Brand Name" saw_0, "Up Level"."Trial - level 12" saw_1, "Year"."Transaction Year" saw_2, "Year"."Transactoin Month" saw_3, "Year"."Transaction Date" saw_4, tranSale.count_of_transactions saw_5, Avg(tranSale.count_of_transactions by "Up Level"."Trial - level 12", "Year"."Transactoin Month", Product."Brand Name") saw_6 FROM tranSale_cube WHERE ("Up Level"."Trial - level 12" IN ('0', 'Product Upsell')) AND ("Year"."Transactoin Month" >= '2009 Feb') AND ("Year"."Transaction Date" BETWEEN timestampadd(sql_tsi_day,-31,current_date) AND current_date) ORDER BY saw_0, saw_1, saw_2, saw_3, saw_4
I believe it must be something with the essbase that is not serving OBIEE well. Because I tried the same filter on a different environment not having essbase, it return me the right results..
Could anyone help?
ThanksAnother example to look at to see historical data for x number of years in the past from current year can be found in this blog:
http://oraclebizint.wordpress.com/2008/03/11/oracle-bi-ee-101332-rolling-yearmonth-and-date-filters-moving-window-filters/ -
How to compare current_date+1 of each month
Hi,
Hope you can give me some indications on how to recreate the report shown in the link below.
I need to compare the rooms situation for the current day and next day for each month starting from current month for the future months.
How can achieve this?
Do I need to create so many rooms colums for the number of months and use filter expression to look at each month?
http://a.imageshack.us/img835/356/monthcomparisons.jpg
What about the filter on Day?
I have created so far a filter on Day:
Day is eqaul to/is in :
current_date
timestampadd(sql_tsi_day,1,current_date)
Month is eqaul to/is in :
current_date
timestampadd(sql_tsi_month,4,current_date)
I tried to strip month and year, from day in the pivot table, but than it is not recognized as date and it errors.
Thanks and Regards
Giulianohi,
Pull a dummy column in criteria
In fx SUM(room by month,day) -SUM(revenue by month,day) and place it at end of measures section so that u ll get the difference for every month
Reference :Column wise grand total
Better do all the day and month calculation in rpd itself
thanks,
saichand.v -
Filter for Current_Date
I was using a a filter of:
Scheduled Date is greater than or equal to Current_Date
However, I noticed that some data was not included. I suspect it is because of the default time that might be included when I use this filter. Does anyone know what the default time would be?
In any case, I think if I modified the filter to add one day to the Current_Date it would solve my problem. Does anyone know how to do this?Too add one day use :
TIMESTAMPADD(SQL_TSI_DAY,1,CURRENT_DATE)
If you think the time portion of a date you can always truncate it (reset the time , will be represented as midnight). However this will make any indexes on that column illegible by the query optimizer. Your idea of moving the current date is fine. -
CURRENT_DATE in Date parameter
Hello guys!
I'm trying to put the CURRENT_DATE as default value in my date parameter. I'm working on Publisher 11g Data model.
It is possible? If not, any workaround?
Thanks for your time!
Regards,
Arielsorry replied again by mistake
try this
{$SYSDATE()$}
if it helps you assign some points by marking it as correct or helpful and close the thread as answered so that it will be helpful for others
Edited by: Avinash_Varma on Mar 5, 2013 10:52 AM -
CURRENT_DATE in EclipseLink/JPA
When I use CURRENT_DATE in JPA queries for date comparisions, it seems to be taking time into consideration as well. So when I comapre a date with CURRENT_DATE, even though the date I am comparing is today's date, the results state that CURRENT_DATE is greater because it takes the current time into consideration. Based on docs CURRENT_DATE in JPA queries is for Date only.
CURRENT_DATE: Returns the current date.
CURRENT_TIME: Returns the current time.
CURRENT_TIMESTAMP: Returns the current timestamp.
http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13946/ejb3_overview_query.html
My query
SELECT a FROM Approval a WHERE a.dateRange.endDate >= CURRENT_DATE
In this case even though the endDate is todays's date, I get no results back because the end date has only date while the CURRENT_DATE has teh current time stamp as well.
I would gretaly appreciate it if anyone has some ideas about this and can help me.What database are you running against? The platform should be auto-detected but you may need to set the property "eclipselink.target-database" in your persistence.xml file.
-
Current_date -2 in Case Statement
Hi,
When i am writing this Conditional Statement in OBIEE Answers.
CASE WHEN "Orders - Sales Order Detail"."SOD_Date Promised Shipment" > CURRENT_DATE
THEN "Orders - Sales Order Detail"."SOD_Date Promised Shipment"
ELSE
CURRENT_DATE-2
END
I am getting this error Help Me...................
[nQSError: 10058] A general error has occurred. [nQSError: 22023] An arithmetic operation is being carried out on a non-numeric type. (HY000)
SQL Issued: SELECT "Business Unit"."Company (0006)", "Item - Item Branch"."Planner Number", "Item - Item Branch"."Stocking Type", "Item - Item Master"."Item Number 2nd", "Orders - Sales Order Detail"."SOD_Amount Extended Cost", "Orders - Sales Order Detail"."SOD_Amount Price per Unit", "Orders - Sales Order Detail"."SOD_Business Unit (MCU)", "Orders - Sales Order Detail"."SOD_Buyer Number", "Orders - Sales Order Detail"."SOD_Date Order Transaction", "Orders - Sales Order Detail"."SOD_Date Promised Shipment", "Orders - Sales Order Detail"."SOD_Item Description", "Orders - Sales Order Detail"."SOD_Item Number 2nd", "Orders - Sales Order Detail"."SOD_Order Type", "Orders - Sales Order Detail"."SOD_Status Code Last", "Orders - Sales Order Detail"."SOD_Status Code Next", "Orders - Sales Order Detail"."SOD_Units Qty Backordered Held", CASE WHEN "Orders - Sales Order Detail"."SOD_Date Promised Shipment" > CURRENT_DATE THEN "Orders - Sales Order Detail"."SOD_Date Promised Shipment" ELSE CURRENT_DATE-2 END , CASE WHEN "Orders - Sales Order Detail"."SOD_Units Qty Backordered Held" > 0 THEN "Orders - Sales Order Detail"."SOD_Amount Price per Unit" *"Orders - Sales Order Detail"."SOD_Units Qty Backordered Held" ELSE "Orders - Sales Order Detail"."SOD_Amount Extended Cost" END FROM "RT ODS Order Management ROW - Orders"
Kind Regards,
MohanHi,
use
CASE WHEN "Orders - Sales Order Detail"."SOD_Date Promised Shipment" > CURRENT_DATE
THEN "Orders - Sales Order Detail"."SOD_Date Promised Shipment"
ELSE
TIMESTAMPADD(SQL_TSI_DAY,-2,current_date)
END
Thanks,
Saichand.v -
CURRENT_DATE-1 in filter
Hi All,
I want to pull out 1 day old data from OBIEE.
I can use filter SELECT CURRENT_DATE FROM "Transaction Data" and this gives me output for today.
But when I use SELECT CURRENT_DATE-1 FROM "Transaction Data", this gives me error.
Any pointers how can I achieve this?
RegardsChange the filter to SQL and add:
SELECT TIMESTAMPADD(SQL_TSI_DAY, -1 ,CURRENT_DATE) FROM "Transaction Data"
This should work fine. However, if you wanted to be really clever you could create a new initialization block in the RPD and add this statement to a variable called "YESTERDAY" and then your users would just need to remember the variable name rather than the SQL.
Thanks,
Chris R -
Using CURRENT_DATE function in DATE column
Hi
I am not able to use CURRENT_DATE function in my target DATE column.I am getting error like "EDATE": invalid identifier with defintion as 'Insert PK error'. This column is not there in the source table.
Data Transfer from Oracle to Oracle
IKM = SQL Incremental Update
CKM = SQL Check
LKM = LKM SQL to SQLHi Shaishavi,
check your Target datastore in Model whether it contains the DATE column or Not.
have you use this Date column in PK?.
Colud you please sent me the Error command which you have faced? And tell me about the interface detaily.
Thanks,
Madha. -
Question about using "current_date" in OBIEE filter
Hello guys
I have a metadata set up as the following:
Logical Fact table has 2 LTS, each has a fragmentation content defined as:
LTS1 ----- Dim.Dates < current_date
LTS2 ----- Dim.Dates >= Current_date
With this setup, when the filter on the dates column is selected to be current_date's date or after, the query will hit LTS2 fact, otherwise it will hit LTS1.
I have a report that need to filter dates between yesterday's date and 20 days ago from yesterday, in other words, it's like a rolling 20 days. I configured the filter using "is between Timestampadd(sql_tsi_day,-20,current_date) and Timestampadd(sql_tsi_day,-1,current_date)"
It is showing me the correct data as far as that goes, however, it is taking much longer time to get the result because the SQL query is doing a "union all" since "Current_date" is still being used to scan the table, the it seems that the filter is making the query to go throu both LTS1 and LTS2 and union the results. Therefore, not only it is taking longer to return data, but also returning incorrect data as well.
Is there a way I can configure the filter so that it is still giving the right dates and without going throu both LTS tables with "union all?" I have tried creating 2 dynamic variables that has "select trunc(sysdate -1) from dual" and "select trunc(sysdate -20) from dual", however when adding these 2 variables on the filter, it will return no data.
Please help
Much thanksHi, Shereen. Every Powerbook battery wants to be used — drained and then recharged — at least every couple of weeks. If you've always used your Powerbook on AC power nearly all the time, and not followed that pattern of discharging and recharging the battery every week or two, it's possible that your use habits have shortened the lifespan and prematurely diminished the capacity of your old battery. Of course it's also possible that your battery is merely old, as a battery's capacity also diminishes with age regardless of how it's used. You didn't say how old the battery is in years, so this may or may not be an issue. I mention it only because it can be an issue.
For general information on handling a battery for the longest possible lifespan, see this article. My advice on the basis of that article and long experience reading these forums is that it would be OK to do as you propose, but I doubt that you'd derive any significant benefit from it. You would still want to be sure of putting the new battery through a charge/discharge cycle every week or two, even if you didn't have a reason to use the Powerbook away from home or your desk, because sitting unused outside the computer is just as bad for a battery as sitting unused inside it. And you should never remove the battery from your computer when it's completely or almost completely discharged and let it sit that way any longer than a day or two.
Message was edited by: eww -
OBIEE - Use CURRENT_DATE in where condition
Hello All,
I want to use CURRENT_DATE in one column named "Incident Date/System"."Submit Date(GMT)". I just want to extract CURRENT_DATE(06-02-2013) data.
I want to use that field like "Incident Date/System"."Submit Date(GMT)" = CURRENT_DATE. But i am not able to do it. Please help me on this.
*<code>*
SELECT CURRENT_DATE saw_0, "Incident Basic Details"."Incident ID" saw_1, "Incident Basic Details".Impact saw_2, "Incident Basic Details"."Incident Details" saw_3, "Incident Customer"."Customer Name" saw_4, "Incident Customer"."Customer ID" saw_5, "Incident Assignment"."Assigned Group" saw_6 FROM "Enterprise Remedy" WHERE "Incident Assignment"."Assigned Group" = 'Standard Oracle Production Support' ORDER BY saw_0, saw_1, saw_2, saw_3, saw_4, saw_5, saw_6
*<code>*
With CURRENT_DATE
*<code>*
SELECT CURRENT_DATE saw_0, "Incident Basic Details"."Incident ID" saw_1, "Incident Basic Details".Impact saw_2, "Incident Basic Details"."Incident Details" saw_3, "Incident Customer"."Customer Name" saw_4, "Incident Customer"."Customer ID" saw_5, "Incident Assignment"."Assigned Group" saw_6 FROM "Enterprise Remedy" WHERE "Incident Assignment"."Assigned Group" = 'Standard Oracle Production Support' AND "Incident Date/System"."Submit Date(GMT)" = CURRENT_DATE ORDER BY saw_0, saw_1, saw_2, saw_3, saw_4, saw_5, saw_6
*<code>*
Thanks,
JitenOn Column "Incident Date/System"."Submit Date(GMT)" click on Filter->Add Button->SQL Expression and then use current_date
or else
On Column "Incident Date/System"."Submit Date(GMT)" click on Filter->Advanced Button->Convert this filter to SQL
and then use current_date
Before doing this I would suggest to validate the data format and values, you might need to cast where ever needed.
Mark if helps -
How to create a prompt with default value as current_date?
Hello
I'd like to create a prompt on the dashboard that has current_date as the default value. Is it possible to achieve so?
Please provide any pointers..
Thank youUnfortunately, no. Presentation variables are declared in a dashboard prompt (see page 44 of this link http://download.oracle.com/docs/cd/B40078_02/doc/bi.1013/b31767.pdf)
Any other type of workaround would not be worth the trouble of asking the developers to create the variable for you. One note, the current date may very well already be defined and just not known to you. Can you ask your developer if he/she has a variable that contains the current date or how long it would take to create one for you?
As a whole, it would be nice to have a set of "date" repository variables if you run Requests based on common date ranges (e.g., first day of current month, last day of current month, first day of quarter, last day of quarter, most recent end-of-year date, etc.) These can be very useful in automating reports so they don't require prompts. Of course, it depends on your organization and what you use OBIEE for...
We have built many such variables and it has been very valuable to the users and report builders. Just a thought... -
JHS-00114: Date $CURRENT_DATE$ must be of format MM-dd-yyyy
I am using jheadstart 10.1.2.2(build 32) in jdeveloper 10.1.2.1.0(build 1913).
I need to display current date for a date field as a default value when inserting new rows.
I set $CURRENT_DATE$ in default display value for that date field. The default value(todays date) is displayed only on a tabel(multi row insert is allowed) and on a form(single row insert) I get the above error JHS-00114: Date 2007-01-02 14:18:37.0 must be of format MM-dd-yyyy.
The problem with multirow insert on a table even though it displays default value is user has to fill in other mandatory fields in the row since jheadstart thinks that user already started entering new row.
It's ok for me if the default value is displayed properly on either table or form.
Thanks for any help.
Lavanya.Whenever you are in PM:
sys@sid1> l
1* select to_char(sysdate, 'MM/DD/YYYY HH12:MI:SS AM') from dual
sys@sid1> /
TO_CHAR(SYSDATE,'MM/DD
07/09/2007 01:22:48 PM
1 row selected.
My time is 1:22:48 PM here. Even though I put AM in the to_char format, it noticed it was PM and changed it. -
If in a form, I assign current_date to a variable like ' wdate:=current_date' the variable get incorrect value than if i assign like 'select current_date into wdate from dual'
Why?, current_date is always from database session isn't it?
Thanks for your help.Hello tony.g
This is the code:
:b11.femovi is a form field date type;
In this code wdate shows differente value than :b11.femovi.
I think that the value must be the same because "current_date" is a database variable isn't it?
declare
wdate date;
begin
:b11.femovi := current_date;
select current_date into wdate from dual;
rutmensaje('date='||to_Char(wdate,'dd/mm/yyyy hh24:MI')||'-'||to_Char(:b11.femovi,'dd/mm/yyyy hh24:MI'));
end; -
BI current_date problem!
Hello!
We've got a strange problem: BI answers returns wrong CURRENT_DATE value when we use it in the function(on the column). On the other hand, server running with correct date and time. Does anybody know, what's wrong???
Thanks in advance.
P.S. Direct query to the database 'select current_date from dual' works fine.
Edited by: Konstantin Goryachev on Jun 18, 2012 12:10 AMThe query to the DB brings the sysdate of the the DB server, while BI answers display that of the BI server. BI and DB servers can be (and often are) installed on different boxes.
Maybe you are looking for
-
Photoshop bridgecc problem with cache.
When I launch Bridgecc, I get this message. I have gone to Bridge preferences and purged the cache, but the message still shows on startup. Any answers to my conundrum?forumnotifier
-
No Power Key - How To Identify Model - In Chinese!
My wife has a Nokia Lumia 710. We think. She's got it all set up in Chinese. Left it with me to fix. The problem is she can't sent text messages. I can't read Chinese. When I go to trouble shoot I download the manual and straightaway find much mentio
-
Advanced action appears looped -Captivate 6
I have an HTML5 project that links out to another URL page on about 5 slides. Jim was kind eough to inform me that there is a known issue about Captivate linking to URLs that are not hand typed. All of the URLs are hand typed, and all advanced
-
How can I make mp3 versions of songs I have purchased? Under the 'Advance' in the menu for iTunes, Creating mp3 version is dimmed.
-
Why is my Samsung suddenly taking forever to load emails? It has used almost 1 GB of data in two days! All in background data; very little in foreground.