In Data Studio Filter Data to < Current Hour - google-analytics

I do a lot of day-of reporting and one of the things I'm trying to do is compare today's performance to another day. The trouble is I'm trying to comp. to that day to the last full hour. Essentially filter out all data in that comp day that happened after the last completed hour.
I've accomplished this in Tableau but I'd like for this report to be done in Data Studio. Is there a way of using functions to create a custom metric that returns the current hour? If I could get that I could easily use it as a filter for my report.
Thanks for any help.
Here's what the solution looks like in tableau:
IF [Session Hour (int)] <= [Current Hour]
THEN
[Revenue GA]
END
And:
DATEPART('hour', Now())-4

I was able to filter to the current hour by
a) making a calculated field to figure out the minutes difference between now and the data
minutes_before_now = datetime_diff(current_datetime(),the_time,MINUTE)
and b) filtering the data where this field was < 60

My advice would be to create a filter inside a date range, p.e.
And then you can choose the comparison range within the primary date range.
That's what I'd do, if I understood your question.

Related

Custom field days remaining to finish a task

How can I create a formula that allows me, in a custom field, to calculate the remaining days of the task, with respect to the last data cutoff (Status Date), as long as it is not 100% complete?
I have tried to create a simple formula to perform the initial test of the remaining days, using the status date field and the end field, [End]-[Status Date], but the result is wrong.
Just use the "Remaining Duration" column that already exists in MS Project, it shows exactly what you are asking for.

How do I create a "Users by time of day" heatmap in Google Data Studio?

I want to create a heatmap in Google Datastudio similar to the "Users by time of day" heatmap in Google Analytics.
This is how it looks in Google Analytics.
THE FIRST PROBLEM is that when I have my columns as the days of the week, it sorts on ascending/descending value alphabetically, NOT Sunday, Monday, Tuesday, etc.
THE SECOND PROBLEM is that I can't actually get the heatmap coloring.
THE THIRD (not a problem, but a preference)...is there a way to group every 2 hours like Google Analytics does?
I am creating this using the PIVOT TABLE chart. Should I be using a different chart? Any other ideas?
You can get something pretty close by doing this. Add a Pivot table, and modify the following settings.
Row Dimension - Hour
Column Dimension - Day of week
Metric - Users
Sort Row 1 - Hour - Ascending
Sort Column 1 - Day of Week Ascending
Then under the Style tab
Metric - change from Number to Heatmap
For the 2h interval I solved it by going in to the data source editor, click count on hour then it creates a copy that takes a formula, so i entered the formula
CASE
WHEN HOUR IN ("00","01") THEN "00-02"
...
...
...
WHEN HOUR IN ("22","23") THEN "22-00"
ELSE "Other"
END
I've recently written a tutorial on how to create this report in Data Studio.
As a summary, you need to use a "Pivot table with heatmap". Use Hour of Day as your Row Dimension, and a calculated field for Day of the Week as your Column Dimension. The code for the calculated field is in my post and it essentially adds a number before the name of the day so you can sort them alphabetically. Then, add your Metric: Sessions.
There is also a link to the dashboard that I made publicly available for anyone to copy and apply their own data.
The link to the post with step-by-step tutorial and access to dashboard template is: businessahead.co.uk/users-by-time-of-day-google-analytics

Access 2010 No records returned based on date/time field

I must be brain dead today because I cannot get any records to return in a SELECY query. I'm trying to select records for the last 30 days (since 2/8/2016). I know there are records in the database since 2/8/16. This is my selection criteria: >#2/7/2016 11:59:59 PM#. I'm not sure why I'm not getting any records. I've looked at the table and the field I'm trying to select on is Date/Time (General Date format). Any suggestions would be appreciated as this is making me crazy. Thanks for the help.
I would just use the date part of it, without the time. So...
=#2/8/2016#
If this is to be variable date for the last 30 days from today, you could also write it as
=Now()-30
Hope this helps.
Josetta
Use this criteria for your date field:
>=DateAdd("d",-30,Date())
or for a specific date:
>=DateAdd("d",-30,DateSerial(2016,3,1))
or, if 30 days means a month:
>=DateAdd("m",-1,Date())

AppInventor: how to insert DateTime into Google Spreadsheet and show only recent DateTime

I am new to this forum so I hope I asking my question in the right place.
I have a problem inserting a datetime into a Google Spreadsheet from a form created in Appinventor2;
In app inventor2 I created a form that fills in a google spreadsheet. Basically I merged the Pizza Party example (http://appinventor.mit.edu/explore/ai2/pizzaparty.html) with this example http://puravidaapps.com/spreadsheet.php to use google spreadsheet instead of fusion table.
the user selects in how many minutes he wants his order and then sees all the orders in a table sorted by delivery time.
Problem A)
Firstly, i want to save the current datetime + the desired delay into the google spreadsheet and sort the table by this new datetime.
1) when i use the block "call clock format time" + "call clock addminutes" the spreadsheet is populated with a text, but then i can't sort the table by delivery datetime. in fact i believe the sorting is done on the number regardless of the am/pm or day of the month. so for example instead of having 4am, 6am, 2pm, 3pm i get : 2pm, 3pm, 4am, 6am.
2) I then tried to remove the block "call clock format time" and in the google form i kept the field format = text
but the google spreadsheet is populated with the following:
java.util.GregorianCalendar[time=1395531335908,areFieldsSet=true,lenient=true,zone=Europe/Dublin,firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2014,MONTH=2,WEEK_OF_YEAR=12,WEEK_OF_MONTH=4,DAY_OF_MONTH=22,DAY_OF_YEAR=81,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=4,AM_PM=1,HOUR=11,HOUR_OF_DAY=23,MINUTE=35,SECOND=35,MILLISECOND=908,ZONE_OFFSET=0,DST_OFFSET=0]
3) I then tried to remove the block "call clock format time" and in the google form I changed the field format = time
but then the google spreadsheet isn't populated with anything.
4)I tried using the segment block, but after a while I realised the block "format time" actually returns this format: "hh:mm:ss AM/PM"
so selecting the 5 characters is not good enough because it does not take into account of the am/pm element as well as the day of the month.
5) I found a temp solution by defining the desired delivery time as a new global variable, and extracting a string in the format hh:mm by joining the blocks ".hour instant" and ".minute instant".
However this is not a final solution because what i extracted is of course a string of text and when sorting, 01:10 will be always considered smaller than 23:50 for example, regardless of the date.
So is there a way of actually saving in the google spreadsheet not a string of text, but actually the date and time?
Problem B)
Secondly, I would like to filter/show only the rows of the google spreadsheet have a delivery time expired by no more than 1 hour (as well as orders with delivery time in the future e.g. in 2 hours from now()).
I tried using some Google Visualization API Query Language commands, altering the url of the google spreadsheet (like WHERE "now() - Delivery Time < 60 mins)" (cannot remember the exact code I wrote) but unsucessfully.
Would anyone know how to filter my results?
thanks in advance
alterettore
So there's a few things to note.
If you're using Taifun's example as you mention, you'll notice that when you submit data to Google Spreadsheets using a form, the first column is always a timestamp, even if you're not submitting a date or time. Trying to send the current date/time is redundant - go ahead and make use of what Google provided.
Google Spreadsheets (and Excel) store Date/Time as a number. If you want to store a date in GS, the best way to do so is not formatted text, but by sending a number. Use AppInventor to calculate the number you need. For example, today (April 27) in GS is 41756. Noon today would be 41756.5
To generate this number, start with AI's Millisecond function. NOTE: Both GS and AI use milliseconds, but they have different 0 points, so you have to manipulate the result a bit. The formula I've used in AI in the past is this:
GS Date/Time = (Clock1.GetMillis(Clock1.Now) / 86400000) + 25569
Hope this helps!

Setting report to current date

I have a report where it shows meetings and their requirements. However i just want the report to show ONLY today's stuff--not the entire week's worth.
I tried setting my group header (i'm grouping by day) to currentdate but yet it still shows me the entire week. I then have to go to the grouping tree and select today's date. Is there any way to run my report and have it ONLY show today's stuff and nothing else???
Any ideas?
Use the select expert to limit the results to today's date. printdate is a special Crystal Formula keyword.
{table.date_field} = printdate
Or, if you're working with a datetime db field you can strip the time with CDate
CDate({table.date_field}) = printdate
One way would be to change your query so that it's only getting one day's worth of data; that is, assuming your data contains a date field. To take it a step further, you could add date parameters to the query itself and leave the group headers as is. That way, you can have one day of data, or data from a specific date range.
If you have no influence (or desire) to change the way data comes into Crystal Reports, you could also add a formula via the Section Expert to suppress the group or detail section unless the date is the current date.

Resources