Cognos 11 Analytics - cognos-11

First time posting.
Our fire response agency just moved to Cognos 11 after qRep. I know little to nothing about SQL, modules, cubes, or data analytics, but I'm one of the few in our agency that can write an excel function so I guess I am considered the in-house data expert.
With that in mind, I need some help.
I want to compare a calculated result (time interval) to a static goal. For instance, if the calculated result is 01:00, how do I express a static goal of 01:20 as a time interval to make the calculation work?
Here is the formula I used for my "Static Goal" column:
IF([Inc Cat]='EMS') then ('60')) else
IF([Inc Cat]='FIRE') then ('80')) else
NULL
I need to convert the 60 and 80 above as seconds so I can compare a calculated time interval to these values.
I appreciate any help, but please review the second sentence of this post prior to replying.

Solved. I removed the single quotes and wrote out the complete time.
IF([Inc Cat]='EMS') then (0 00:01:10.000) else
IF([Inc Cat]='FIRE') then (0 00:01:20.000) else
NULL

Related

SUM gives me a date instead of a number in Google Sheets

I am writing a few simple formulas for Google Sheets and I've been stuck on this for a little while now. I am trying to get a quick overlook of how many people got added to a sheet in the past week, counting from Saturday, but unfortunately, it's not working.
I have this piece of code to set the date since last Saturday.
=TODAY()-WEEKDAY(TODAY())
This works just fine. The output gives the date as 3/7/2020.
I then have a different row which checks if the recruitment date, which is stated somewhere differently, is bigger or equal to past Saturday. It checks it like this:
=IF(I2>=K2, "1", "0")
This gives an output of either 1 or 0 (1 if it was on Saturday or after Saturday, 0 if not).
Then I went to the main page, where I want to put the SUM. I put the following code:
=SUM('Control Center'!J2:J)
It should just add the 1's that are said earlier, but instead, it gives me the following date: 12/30/1899.
Does anybody know what went wrong? If you need any clarification, feel free to ask.
go to 123 menu and select Automatic or Number:
Take the quotation marks off the 1 and 0 so:
=IF(I2>=K2, 1, 0)

How can I select the data between some specific hours in a specific month?

I already have InfluxDB working and getting monitoring data about some services (the value is just 1 for up and 0 for down). For the management I need to select the values from the database that are in a specific month and either night time or day time. For example: I want to select all the data from April 2019 (doesn't matter if it 1 or 0) between 08:00AM and 07:00PM (day time)
Here is what I've tried:
SELECT value FROM probe_success
WHERE "instance" = 'https://myservice/api' AND time >= '08:00:00' AND time < '19:00:00'
AND time >= '2019-04-01' AND time <= '2019-04-30'
But I've got an error:
{"results":[{"statement_id":0,"error":"invalid operation: time and
*influxql.StringLiteral are not compatible"}]}
Can anyone tell me what I'm doing wrong or point me in the right direction?
Thank you very much!
Ok, so after some research I've found that it is not possible to use the "OR" statement in a "WHERE" clause to specify multiple time ranges. See this. I solved this problem by sending separate requests for each day in a for loop and then concatenate all the results. It's not the best solution, I admit, but since they say it's not possible I guess this is the workaround.

Google spreadsheet, comparing durations

I calculated a duration between two times, e.g. between 9:00 am and 11:00 am. So far so good. Now I need to decide if this duration is less 6 hours.
I do remember that this was pain in the s in excel but nevertheless I tried it the simple way:
=IF(E2 < 06:00:00; "y"; "n")
of course that didn't work. Next:
=IF(DURATION(E2) < DURATION(06:00:00); "y"; "n")
still, it didn't work.
So, okay, how can I compare two duration?
Divide hours by 24:
=IF(E2 < 6/24, "y", "n")
Value is E2 is a formatted time, actually 1 hour is 1/24, 1 day is 1.
Some info about date and time formats here:
http://www.excel-easy.com/examples/date-time-formats.html
You can also use the HOUR function if you want to
=if(HOUR(E2)<6,ʺyesʺ,ʺnoʺ)
or
=if(E2<time(6,0,0),ʺyesʺ,ʺnoʺ)
(if you write 06:00:00 in a formula it takes it as a string not a time)
but as I'm sure someone is about to point out, the first formula above gives the wrong answer for durations of more than a day (because it takes the hour part of a datetime).
What I find interesting is that you can assume for a worksheet formula that dates and times are represented as whole numbers (days) and fractions (parts of a day) just like in Excel. If you ever have to deal with them in Google App Scripts, you suddenly find that it's object-oriented and you have no choice but to use methods like hour() to manipulate them.
I needed to use the equivalent of:
=if(TIMEVALUE(E2)<6/24, "yes", "no")

How ot write points into influxdb 0.8 with time in seconds

I would like to write points into an influx 0.8 database with the time values given in seconds through HTTP. Here's a sample point in JSON format:
[
{
"points": [
[
1435692857.0,
897
]
],
"name": "some_series",
"columns": [
"time",
"value"
]
}
]
The documentation is unclear what the format of time values should be (nano or milli seconds?) and how to specify to influxdb what to expect. Currently I'm using a query parameter: precision=s
That seems to work fine, the server returns HTTP Status code 200 as expected. When querying against the database using influx' admin interface using select * from some_series the datapoints in the table are returned with the expected timestamp. On the graph however, the time axis is indexed with fractions of seconds and queries like select * from some_series where time > now() - 1h dont yield any results.
I assume that there is something wrong with the timestamps. I tried multiplying my value by 1000 but then nothing gets inserted into the database with no visible errors.
Whats the problem?
By default, supplied timestamps are assumed to be in milliseconds. I think your writes are defaulting to milliseconds because the query string parameter should be time_precision=s, not precision=s.
See the details under "Time Precision on Written Data" on https://influxdb.com/docs/v0.8/api/reading_and_writing_data.html.
I also think the time value should be an integer rather than a float. I'm not sure how to explain the other behaviors, where the timestamp seems to be the right date and multiplying by 1000 doesn't solve the issue, but I wonder if it's related to writing floats.
Please contact the InfluxDB support team at support#influxdb.com for further assistance.
I found the solution! The problem was only in part with the precision. Your answer was correct, the query parameter is called time_precision and I should post integers instead of floats. Which was probably the first thing I attempted with no results...
However, due to some time zone problems, my time values where in the future relative to server time and by default, any select statement includes a where time < now() statement. So, in fact values were written into the database, but not displayed because of that hidden where statement. The solution was to tell the database to return "future" values, too:
select value from some_series where time < now() + 1h

Returning Modified Following business date while building Quarterly calendar

Trying to build a quarterly calendar of working business days (adjusted by holidays).
I am using =edate (A1,4), the only problem is that this function does not adjust for business days. Ideally I would wrap the formula using =workday(edate(A1,4),0,USD_Hols) but it seems that I cannot just add "0" for the formula to return the next business day.
Does anyone know how to get the next business day and also if next business day falls in the next month return the nearest previous business day?
Thanks
Paco
I think this works based on your description on comments. I'm not quite sure what you mean by "previous" in the comment. Below, I'm assuming that it means A1, if A1 is a workday, or the workday before A1 if A1 is not a workday:
=IF(MONTH(WORKDAY(A1,1,USD_Hols))=MONTH(A1),WORKDAY(A1,1,USD_Hols),WORKDAY(WORKDAY(A1,1,USD_Hols),0-1,USD_Hols))
I haven't used workday functions much. One thing I notice is that a 0 argument for days seems to return the date in A1 even if it's not a workday. That's why I included the nested IFs in the ValueIfFalse part of the main IF. It forces it to the next workday and then the one previous to that.
You must add the worksheetfunction to the Workday to Excel 2010
This is correct:
Function NextBiz(d As Range, holidays As Range) As Date
If WorksheetFunction.Weekday(d) = 7 Or WorksheetFunction.Weekday(d) = 1 Or WorksheetFunction.CountIf(holidays, d) > 0 Then
NextBiz = WorksheetFunction.WorkDay(d, 1, holidays)
Else: NextBiz = d
End If
End Function

Resources