Webi: How to use double slider input control with dates? - date

My boss asked me to add a double slider input control for the date information on a report on Webi.
We have several columns and two of them display a date (start and end date of procedure). So I need to have two double slider, one for each date.
I've been searching for a whole day now and I know that it is not directly possible to use double slider with dates, because double slider only works with values (measures) and dates don't have that.
But I managed to create two more variables on the business layer. I used the following SQL function:
CAST(currentDate as Bigint))
These variables are displaying the date as numbers (e.g. 1090101 for 01.01.2009 (format is "dd-MM-yyyy")).
And it is working great! But it displays the dates as number, which is not possible to use for work. No one will know which date is 1090101. I could perhaps let both columns (date as date and date as number) in the report, so people could check the date they want to filter with the input control and select the right number on the slider. This could be a workaround, but not a clean one, I think.
I tried to change the format of the date as number to a date format, but then I could not use the slider anymore (even if the variable is a number).
I looked for a way to change the formatting of the values displayed on the slider, but with no luck.
So I'm asking for your help. Does anyone know how I could make this work?
Is there really no solutions for such a useful way of filtering data? I mean, filtering data by an interval of dates is surely something people want to do quite often, I assume.
Thank you in advance for your time.
(Version Webi : SAP BusinessObjects BI Platform 4.2 Support Pack 8 Patch 6,
Version: 14.2.8.3671)

You could format your date value as year, month, day and then convert it to a number so the value you are filtering on makes a little more sense. Like this...
=ToNumber(FormatDate([Your Date];"yyyyMMdd"))
It will be better than just an arbitrary number, but certainly not perfect since you will have large chunks of your range for which there never will be any corresponding data (e.g. 20211232 through 20220100).
What is wrong with just a Minimum and Maximum input controls? They are more intuitive and simple to create. Sometimes what your user or boss asks for is a bad idea and/or just not possible.

Related

How can I calculate my win rate on one column based on the date on another?

I created a rudimentary Google Form to track my win rate at Starcraft. The first column on the resulting Google Sheet is Timestamp created by the form.
I have another column that has my win-loss, and I am able to calculate my percentage for the entire sheet (all games). However, I want to be able to see my daily win rate, and I can't figure out the correct way to go about it.
I tried COUNTIF, COUNTIFS, with TODAY() and I was able to count the games for a certain day, but I don't know how to use it to tie in with my win-loss column. What I currently do is adjust my Daily formula to specify today's date before playing. I was hoping I won't need to do this.
Please see Win-Loss Stats Sheet
Solution:
You can extend your formula to compare against the date in column A:
=(COUNTIFS(D2:D, "Win", ARRAYFORMULA(INT(A2:A)),TODAY())/((COUNTIFS(D2:D, "Win",ARRAYFORMULA(INT(A2:A)),TODAY()))+(COUNTIFS(D2:D, "Loss",ARRAYFORMULA(INT(A2:A)),TODAY()))))
The additional condition would be ARRAYFORMULA(INT(A2:A)),TODAY(), which converts the timestamps into dates and compares them to today's date.
Sample Output:

DATE FORMATTING - COGNOS

I am using cognos version 10 and I need my dates to display in this format 'yyyy-mm' but it is showing dates like '2014-04' as '2014-4' so it is reading the dates out of order by producing '2014-11' first because it starts with a one. I need to add a zero to those double digit integers that way the months(specifically) will display in order.
here's an the code I've created in attempt:
_year( start_date ) ||'-'|| _month( start_date )
IF(_month(start_date) > 10)
THEN('0' +_month(start_date))
Short answer: Use yyyy-MM.
Your question lacks a lot of detail, so my response is based on considerable guess-work.
Are you asking about formatting, or do you want to transform the values? Formatting can be done without code. The code for your data item should be start_date.
Is this for a List column body? Where do you enter your format (yyyy-mm)? Are you using the Data format property?
In the Data format dialog, if you can't find another setting that will do what you want, you can enter a pattern into the Pattern property. If you look at the tips at the bottom of the Data format dialog, you'll notice that using yyyy-mm would give you a four digit year, a hyphen, and a two-digit minute. Perhaps you should try yyyy-MM. It works for me.
As for sorting: Even if you used yyyy-M for the pattern, 2014-04-22 (displayed as 2014-4), should sort before 2014-11-01 (displayed as 2014-11). The only reason the sort would be wrong is if it is using some other data besides the dates.

MS-Access: input Quarter-of-year data

Basically I need to allow user input data in a Qq/yy or Qq/yyyy format (i.e. "Q4/2015" where "Q4" means last quarter or year 2015 - not Month 4).
I know I can take a DateTime value and format it with Format() but this is not what I need.
I need to provide user a form with an input control where he/she can type data in the above format and have this value stored in a database such a way that I can later perform reports and comparisons (like select all quarters from Q2/2015 to Q1/2016).
So I have two problems.
Input control.
Data type on my database.
If I simply take a text field in my table and set the input mask to Q0/0099 I will have problems with my queries since I will not be able to compare records with < and >.
If I take a numeric or date field, I donĀ“t know how to properly set a working input mask to set the input the way I need.
Any hints, please?
You will need a DateTime value for later to make calculations and comparisons.
You can have two juxtaposed textboxes holding quarter and year, then use DateSerial:
Me!Date.Value = DateSerial(Nz(Me!Year.Value, Year(Date)), (Val(Right(Nz(Me!Quarter.Value, Format(Date, "q")), 1)) - 1) * 3 + 1, 1)
You can apply inputmasks as well, but many users dislike these.
To display the date as Q4/2015, set the Format property: \Qq\/yyyy
or use =Format(Me!Date, "\Qq\/yyyy") - or just the quarter or year part.

How did this number become this datetime?

We have a vendor which one field in the database is a number and somehow in the app interface it shows the date,
I'm trying to figure out how is this conversion
Here is the data:
this number 15862 generates this date 06/05/2013
I have no idea how, the vendor told us it is NOT a custom logic conversion it was used a tsql function although I can't figure which one.
I tried using "convert" without success.
I don't think that's from a tsql function considering it's derived using the UNIX time epoch. Basically it's number of days since 1969-12-31
But you could get it using tsql like so:
select datediff(d,'1969-12-31','2013-06-05')
It looks like it's using a base-date of 1/1/1970 (actually 12/31/1969) and the number represents the number of days after that.
Most probably this is saved as an offset in days since 01/01/1979:
date('m/d/Y', 15862*3600*24) gives 06/06/2013 and
date('m/d/Y', 15862*3600*24-(3600*24) gives exactly 06/05/2013

Check if one given date is between two dates several years apart?

Todays date is 31.03.2011 (European, at least).
A hotel room is booked from, lets say, 23.02.2011 to 05.05.2013 (yes, over two years!).
How can I check if todays date is in between the reserved dates or not?
Ideally I want to sort it into an boolean array of 3 dimensions, like date(year,month,day) and TRUE means "booked".
Preferred language is VBScript because this is my only option, but Java/C whatever is also okay to use as an example to work from (text explaining the solution is of course also okay).
Thank you!
Don;t know VBScript but the time/date library can normally return times in an integer format (typically seconds since 1970). Just convert the three dates to this format and check using the normal compare operators
VBScript Functions notes a Datedifffunction that you could use with the 3 variables representing each point in time. Course there are other solutions to this like converting the date to another type and using that for comparison,e.g. concatenate yyyyMMdd into an integer and compare them that way.
checkIn=DateSerial(2011,02,23)
checkOut=DateSerial(2013,05,05)
testMe=Now
If testMe>checkIn And testMe<checkOut Then
MsgBox("Living the good life.")
End If