I would like to identify the earliest timestamps per user and date based on the following data table.
I have found a way to get the earliest time stamp for each user or for each date, but not for each user and date. I am looking to find the earliest timestamp for each dates for both 'Bob' and 'Bill'.
What function can I use to incorporate the multiple users and dates?
Use a pivot table
Split like this:
Related
I have a dataframe which consist of order_date,order_time for multiple restaurant. I want to create a new column which would calculate the queue based on order date and time.
I have tried using diff() on order time along with group by on order_date and restaurant_id but it didnt worked.
Expected output : a new column 'time_diff' which would contain difference between consecutive orders for same restaurant and on same date.
I want to schedule the mailing of a Cognos report, always using the current date. So, for example: today, I want to e-mail the report with data up until the 28th, but tomorrow it should contain data up until the 29th.
How can I achieve this?
Thanks in advance!
If you're expecting code, you didn't provide enough information, but let me try...
Assuming the "date" data against which you want to filter is in a query item named [Date] which is in a query subject named [Time] which is in a namespace named [namespace], create a filter like this:
[namespace].[Time].[Date] = current_date
If you want up to the current date which includes the days leading up to it you can use what dougp posted slightly modified.
[namespace].[Time].[Date] <= current_date
to ensure the where clause is pushed down to the database, I personally like to use a macro for current_date. So the expression becomes
[namespace].[Time].[Date] <= # timestampMask ( $current_timestamp , 'yyyy-mm-dd' ) #
I need some suggestion to generate a continuous dates in between a specified selected date range in Cognos. I can create a separate Data item for this but I don't know what to do after that. Looking for a quick help
You need to get your list from a Calendar table which joins to your query in framework, or create a seperate Query Subject that pulls in the date list from a Calendar table or custom SQL. For more info on generating a range of dates using SQL see this: Generate a range of dates using SQL
Once you have a query subject with a date field that contains 1 record per date you want, create a dummy field to use to join it to your main query. A simple data item named 'join1' with the value '1' will work. Create the same field in your main query. Join the two Query Subjects together on the 'join1' field. This is going to result in your data getting multiplied out into the date range. IE. If you have a main query that lists 1 record per employee, the result after the join will be 1 record per employee per date in your date range.
In plain SQL (in my case: sqlite), I would be able to query for a specific date in a DATE column as follows:
SELECT * FROM table WHERE date(dateColumn) = '2015-01-01'
This works because the date() function cuts off the time part of the DATE value.
Can I do something similar with Predicates in Core Data? Or do I have to use something where I determine the start and end of that day and then look for dates between the two date values?
The goal is to sort by date but floored to nearest day as I'm also sorting by user votes. Basically, to sort by day and highest votes so the most votes for the day come up.
Pretty sure you need to store both the precise date and a pre-floored date in your mongodb data and then sort by the pre-floored one. You will see this pattern a lot for doing case-insensitive search on string fields as well. With mongoose, you can use a pre-save hook to automatically set the pre-floored date based on the precise date. Once the data is there, the sorting part just works normally.