I'm looking for a way to set a condition requirement that a specific date field will be equal to today's date, or yesterday's.
How do I do it?
Add a new formula resource of type Date and name it yesterday (or whatever) and put that code in there.
{!$Flow.CurrentDate} - 1
Edit: I am not sure if you are doing something differently but here is a screenshot of a Get Records flow element filtering based on a formula value:
And to be perfectly clear, here is a screenshot of that formula definition:
Related
I'm creating a in google data studio that has a table behind with data by day.
I need it to be comparable with the month before, but there's a catch that I'm currently stuck!
The period should be something like:
DAY(date)/MONTH(date)-1/YEAR(date)
This allows the comparation between periods with different number of days, example:
Date of analysis: 28/06/2021 - 27/07/2021
Date of comparation: 28/05/2021 - 27/06/2021
When trying to create something like this in DataStudio (with date range controls) none of the options does this, and for what I've explored, there isn't an option to do a formula like the one above.
The closest I get is "Previous Period" but that makes the Date of Comparation 29/05/2021 - 27/06/2021, missing the 28/05/2021.
I'm really stuck and running out of ideas, I've even considered changing the SQL query behind to convert the days somehow.
I've done this by mocking the dates for the comparator.
The other way is to create two series, and don't use the comparator.
Series #1 will have label 28/06/2021 and data from 28/06/2021 (current period).
Series #2 will have label 28/06/2021 (the same) and data from 28/05/2021 (previous period).
They plot nicely:
I have a simple Data Studio table consisting of two columns. The first column is the week (ISO Year Week) and the second column is the total registrations we've received for that week.
However, my Week column repeats 7 times (7 Rows) for each week as it's counting by day within that week. See below:
Is there any way to get this to group by the listed week? Below are my settings:
Dimension = Conversion Date set as "ISO Year Week" for the type.
Metric = Equals the count of Conversion Date (Same Conversion Date field used for dimension)
Any help would be much appreciated.
There might be an issue with the date format of the source. Without knowing the source (e.g. Google Analytics or Sheets) it’s hard to tell.
Blended Data
I recently had this issue with blended data. The response of a similar question helped me to find a way.
Basically you have to add a new custom field to the data source with the formula WEEK(date_field_link). Data studio will recognise this as a date in compatibility mode, but for me it still works. Then you can use this new date field as a join key to blend the data while grouping it in weeks.
Normal Data
If this problem appears in a regular non-blended dataset you might want to check if Data Studio correctly catches the date as a date. This help article from Google might be worth checking out: https://support.google.com/datastudio/answer/6401549?hl=en#zippy=%2Cin-this-article
I made a similar case work using blended data.
Your column "Conversion Date" repeats the same week 7 times because it's just a display value. Every row has a date value (year, month and a day) but you're just showing the corresponding week. So, data-studio treats them as different data and doesn't group them.
To be able to group them by Week you need to create a new field with a value containing only the week and the year. So, you can use the formula
YEARWEEK(your_date)
The resulting Date will be groupable.
NB1: If your date isn't of the type Date, you can parse it from text to date using
the method:
PARSE_DATE("%Y-%m-%d", your_date_text)
NB2: If the created field has the type number and doesn't show the possibility to change type to Date, you can do this trick: (it's weird but it works):
First type as a formula for the created field and apply:
MONTH(your_date)
This will unlock the compatibility Date types. You can choose from them the ISO Year Week type.
and then change the formula from MONTH(your_date) to YEARWEEK(your_date) [your formula] as I explained above. The chosen date type won't go away even if it wasn't available the first time.
I have a report with one data source in Google Data Studio. The data is at month level inside the BigQuery table YYYYMM (for example 202001). I have a filter that is set on the year-month dimension which works ok but I would like to add a default value which changes to last month(max(year_month)) available in the table.
Is this possible? I only found the option to hard-code the default selection but this can't be updated dynamically
as in this screen shot
Jaishree's suggestion
You can create an another field/column as same year-month and always keep the latest year-month value as "latest month" or any name you want. You can use logic like
when existing_column = max(year_month) then "latest month" else existing_column
Something like this
existing_column new_column
022020 latest month
012020 012020
122019 122019
112019 122019
You can pass this "latest month" value in the default selection option this option which is just below the dimension. But each time you upload new data you have to update this field like change the table suppose for next month you table should be like
existing_column new_column
032020 latest month
022020 022020
012020 012020
122019 122019
112019 122019
You can make auto update by scheduling queries as well in big query from where you are loading data to Google data studio.
It can be achieved by setting the Date Range (at the chart, report level, Date Range Control, etc) to Last Month.
First, a YYYYMMDD Date field needs to be created at the Data Source. This can be done using the CONCAT function to add a Day (the 15th is used in the formula) and then using the TODATE function (although in this case the TODATE function is not required, however, adding it as best practice):
TODATE(CONCAT(Date, "15"), "%Y%m%d", "%Y%m%d" )
Adding a link to post on the Google Forums (Nimantha; 10 Feb 2020) which also has a GIF to demonstrate the process above as well as adding the Date field at the Report Level.
You can do it by creating a new field where rows that belong to the current year-month are labeled as 'Current Month' while the others could use your preferred formatting (I'm using "%Y%m - %B %Y" as it allows me to sort report dates in a drop down list).
To do so, you need your date column and CURRENT_DATE() in the same format with the help of FORMAT_DATETIME(). Then, you can use CASE WHEN logic as follows:
CASE
WHEN FORMAT_DATETIME("%Y%m", MyDateColumn) != FORMAT_DATETIME("%Y%m", CURRENT_DATE())
THEN FORMAT_DATETIME("%Y%m - %B %Y", MyDateColumn)
ELSE 'Current Month'
END
Finally, you could use a drop down list control with the new field and use 'Current Month' as the default selection. The main advantage is that the code above will be evaluated every time data is refreshed so no extra automations needed.
Hope it works for you.
I am looking for some help regarding an IF function on an Excel document.
Basically if the Date Listed cell is dated over 1 month ago (eg: Date Listed 6-Aug but today is 6-Sep) and the Date Sold cell is blank, then I would like the Mark Down cell to say 'MARK DOWN', which at the moment it does but it is only 10-Aug today.
If the Date Listed cell and the Date Sold cell both contain dates I would like the Mark Down cell to say 'OK'.
So far I have this written:
=IF(AND(DATE(YEAR(G2),MONTH(G2),DAY(G2)), ISBLANK(H2)),"MARK DOWN","OK")
I know I'm not far off but I need help sorting out the last parts..
Bonus if you can help me add a highlighted cell formatting to it :)!
[EXAMPLE IMAGE]
I think this should work
IF(AND((TODAY()-g2)>31,ISBLANK(H2)),"Mark Down","OK")
Apply conditional formatting on all the cells in MARK DOWN column which are equal to OK.
After that write this simple formula to check the condition.
=IF(AND(ISNUMBER(G2),ISNUMBER(H2)),"OK","MARK DOWN")
Update: if you use EDATE function everything gets simplified as this function takes care of exact day differences
so the whole solution is :
=IF(AND(EDATE((G2),1)=EDATE(NOW(),0),ISBLANK(H2)),"MarkDown","")
Let me know if you have any question on how this formula works.
I'm working with the Blog app and I see how to filter the Blog posts by year using the Visual Query Designer. I use the querystring value that has the year and in the ValueFilter and my properties are as follows:
Attribute: PublicationMoment
Value: [QueryString:year]-01-01 and [QueryString:year]-12-31
Operation: between
How would I get the posts from a specific month and year, if those values are passed via query string parameters. Because the months of the year have a varying number of days, I'm not sure how you would accomplish this in the Value field of the ValueFilter. Currently I'm passing the 2 digit month as the parameter.
I tried something like: [QueryString:year]-[Querystring:month]
Operation: contains
but the above operation doesn't really work because the datatype is a DateTime object.
I could do it in the razor view but I'm afraid that the paging datasource would have too many pages in it since it would be based on the larger subset of posts for the given year that was passed in the querystring parameter.
Is there any way to do this with the filter?
Basically dates are not perfectly handled yet, but there are a few ways to do it using the visual query:
Use the correct date in the query like between [QueryString:Start] and [QueryString:End] and calculate the correct dates there where you generate the links
Since your main problem with the "between" filter is actually that it would include the last day too, you could also use a two filters a >= first date and another < second date, so the first-date would be the year/month and day 1; the second one is year-month and day 1 as well
Last but not least: if you do it with razor and LINQ you shouldn't run into any performance issues - it's technically the same thing the pipeline does and it's been tested to perform well with tens of thousands of records.