convert ddmmyy date into prompt in universe SAP BO - sap

I need to display last 2 years of data based on the what date the user enters:
If the user enters 01/01/2015, I need to see data from 01/01/2013 to 01/01/2015
The date will be entered in dd/mm/yy (datetime) format.
How do I achieve this in Webi?
I tried the below code in my universe level filter
DIM_GROUP_CONTRACT.GRP_CONTRACT_EFFECTIVE_DATE between TO_NUMBER(TO_CHAR(trunc(To_date(#Prompt('Select Reporting End Month: ','A','Record Effective Date\Record Effective Month',mono,free,persistent)||'01','YYYYMMDD'),-24),'MM'), 'YYYYMM'))
and TO_NUMBER(TO_CHAR(trunc(Add_Months(To_date(#Prompt('Select Reporting End Month: ','A','Record Effective Date\Record Effective Month',mono,free,persistent)||'01','YYYYMMDD'),'MM'), 'YYYYMM'))
it gives me error
The requirement is to add date in dd/mm/yy format

I found the solution
( DIM_GROUP_CONTRACT.GRP_CONTRACT_EFFECTIVE_DATE between add_months(#prompt ('Enter Date:','D','Group Contract Details\Group Contract Effective Date',Mono,Free ),-24)
and (#prompt ('Enter Date:','D','Group Contract Details\Group Contract Effective Date',Mono,Free )) )
thanks

Related

Month-to-Date metric

I have a situation where the metric calculation(Month to Date Sales) is based on the month from the report date filter.
We want the month to date filter to be for the report month and not the current month - in other words, if the user selects 03/10/2015 for the report date, we want the month sales to be the sales for March,
and not the sales for June.
Is there a way to parse the report date to extract the report month into a variable that can be used in the ‘where' clause of the metrics in order to generate the desired results.
Thanks in advance.
I am not entirely sure if this answers your question, but achieving something like this may be possible when using disconnected timeline date filter. Your metric should look like this:
SELECT Sales_metric BY Month/Year (Date) ALL OTHER WHERE Month/Year (Date) = (SELECT MAX(Month/Year (Timeline)) BY ALL OTHER EXCEPT Date (Timeline))
I hope this helps, in case if it doesn't feel free to log a ticket to GoodData Support at support#gooddata.com.

How to filter month and year in vb 2010 / access

How do I filter month and year from an Access database with a datetime column. The format used in the database is "General Date", an example of which is 1/1/2015 12:00:00 AM.
In hoping do this, I have a DateTimePicker which is set to a custom format yyyy/MMM (2015/Jan). I have thought of converting the yyyy/MMM to general date format but I am worried that it will mess up the filtering somewhat.
The results will be displayed in a DataGridView.

Check if the current date string is within or outside the range of two other dates

I have 2 date pickers. One is for selecting a start date and the other is for selecting an expiry date. When a selection has been made I convert the date to string format and store the results in a two text fields.
This is how I save to the database:
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "MMMM d" // e.g. September 15
let sDate = dateFormatter.dateFromString(startDateField.text) as NSDate!
let eDate = dateFormatter.dateFromString(expiryDateField.text) as NSDate!
activity["startDate"] = sDate
activity["expiryDate"] = eDate
activity.saveInBackgroundWithBlock({ (success: Bool, error: NSError!) -> Void in
What I intend to do is have a table view display 2 sections: one showing activities that are active, and the other showing activities that are expired/not in date range.
I figured I could do this by taking the current date and checking it was within the start date and expiry date range.
My saved date from above is showing up in parse like this:
The thing is, I don't want to take the year or time into account. The only thing that matters is the month and day. So for example an activity could run once a year between September 15th and December 20th.
I need a way to check that the current date is within those two dates taking the day (e.g. 15th) of the month into account. So today's date is October 19 and an activity would be in range if its start date was September 15 and its expiry date December 20, but would be out of range/operation if the expiry date was October 18 or start date was October 25.
So to summarise:
I will be displaying two sections in a table view. One with active activities and another with non-active out of operation activities.
How do take my stored start date and expiry date and easily check the current date is within their range?
For the occasions when users pick either a start date or expiry date I need to check if the current date is greater/less than the start date (to be able to decide if the activity should show up or not) or if the current date is greater/less than the expiry date (to be able to decide if the activity has passed or not passed its expiry date.
It would be nice if I could roll 1 and 2 into one function and use it in the table view.
Would be interested to learn how the more experienced programmer would achieve this.
Instead of the date format "MMMM d" (e.g. "September 15"), you can convert the dates
to a string with the date format "MMdd" (e.g. "0915"). Then you can do a simple
string comparison between the current date, the start date and the expiry date.
For example,
"0915" < "1019" < "1220"
so October 19 is in the range from September 15 to December 20.

calculate leave year from anniversary start date

I am trying to calculate someone holiday year start and end dates based on the anniversary of their joining date.
For example if someones joining date is 23/10/09 i need two fields calculated from this date which would be 23/10/13 for the start of their holiday year and the end of their leave year would be 22/10/14.
Basically i need a query that looks at the dd/mm of the joining date and the current date and calculates the two dates i require.
Another example would be joining date 01/02/10 and the start date of the leave year would be 01/02/14 and the end date date would be 31/01/15. The field name in my SQL database is
[emp_join_date]
Any ideas ?
DATEADD() would be the function you need I believe:
declare #emp_join_date datetime = '2009-10-23'
select #emp_join_date as emp_join_date,
DATEADD(YEAR,4,#emp_join_date) as holiday_start_date,
DATEADD(YEAR,5,#emp_join_date)-1 as emp_end_date

How to check Day & month from date which is in Database table

I have problem here...
I want to check Day & month of date which is in database.
There is date field is in database which is mm/dd/yyyy format If I use "select" query then whole Date is access but I want only these date's which having today's day & month
Example:
if today's date is 02/02/2010 then select only those date whose day is 02 & month is February.(Dont consider Year)
Please be free to ask if you have any problem for understand.
SELECT *
FROM {tablename}
WHERE DAY({datecolumn})=DAY(getdate())
AND MONTH({datecolumn})=MONTH(getdate())
I would use DATEPART to pull out the values you're looking for.