Separating dates between a date range in Google Data Studio - date

I have two dimensions in Google Data Studio in the format Date (From,To) from an external source and now I want to display all days within the time space individually.
Ex: 01.10.2020 - 05.10.2020
---result as table---
01.10.2020
02.10.2020
03.10.2020
04.10.2020
05.10.2020
That's it. I just can't find a solution.

I understand that your ultimate goal is to join the two dates into a single field in the format 01.10.2020 - 05.10.2020.
To do this, you can create a new field that contains the formula:
CONCAT(Date1, ' - ',Date2)
And after, insert this new field in your table. The output format of this formula will be a text type element.

Related

Google Sheets - Expanding dataset according to months between 2 dates

I would like to be able to expand a dataset to include one row per "person" per month, filtered by Start and End Date.
Consider the example below:
This is the desired outcome
Inputs are a start and end date, which could be anywhere between the start of a given financial year (01/04/20XX) and the end of that financial year (31/03/20XY).
The output rows contain each month comprised between these 2 dates for which there is a matching entry in the input (see example output)
I have an example sheet here.
Any help would be appreciated, thanks
Try:
=ARRAYFORMULA(SPLIT(UNIQUE(QUERY(FLATTEN(IF(DAYS(C2:C4,B2:B4)>=SEQUENCE(1,1000,0),A2:A4&","&TEXT(B2:B4+SEQUENCE(1,1000,0),"YYYY-MMM")&","&D2:D4,"")),"where Col1 is not null")),","))
Result:
This works however the only limitation is you have to manually edit the formula to specifically define the End range. It crashes when I set it to use the whole column using the formula below:
=ARRAYFORMULA(SPLIT(UNIQUE(QUERY(FLATTEN(IF(DAYS(C2:C,B2:B)>=SEQUENCE(1,1000,0),A2:A&","&TEXT(B2:B+SEQUENCE(1,1000,0),"YYYY-MMM")&","&D2:D,"")),"where Col1 is not null")),","))
I am assuming this is because of the Query function which runs a Google Visualization API Query Language query across data making it very long and heavy processing.
Explanation:
To explain how this works using the formula from this link: Google sheets - List of dates between a list of start and end dates to get the dates between, but I changed the IF to return all combined 4 columns. Converted it to date format using TEXT (YYYY-MMM). I then used the UNIQUE to remove duplicates so it will only show the months. Then make use of SPLIT to split across 3 columns.
References:
Get dates between 2 dates
TEXT
UNIQUE
QUERY
SPLIT
Hope this helps!

How to Display a single Date in Google Data Studio?

I want to display a single date dynamically in Google Data Studio. e.g. I want to display last Monday's date whatever it was e.g. 09-11-2020 and it would change to 16-11-2020 as the Monday 16-11-2020 would pass and so on.
I have a connection with BigQuery and I can connect from there to bring the date dynamically from BigQuery as:
SELECT DATE_TRUNC(DATE_ADD(CURRENT_DATE(), INTERVAL 7 day), WEEK(MONDAY)) as coming_monday
&
SELECT DATE_TRUNC(CURRENT_DATE(), WEEK(MONDAY)) as last_monday
So calculating dates isn't a problem as they are being received in Google Data Studio, however, I could not display them appropriately using any of the Google Data Studio tools like Text, etc.
Dates can currently be displayed in Google Data Studio Scorecards; in addition, the Calculated Fields in the question could be recreated by copy-pasting the below into the respective Scorecards, aggregating by MAX or MIN (which would display the same Date in this scenario) and then setting the Type to Date (Default: Date & Time):
1) Coming_Monday
DATETIME_TRUNC(DATETIME_ADD(CURRENT_DATE(), INTERVAL 7 DAY), ISOWEEK)
2) Last_Monday
DATETIME_TRUNC(CURRENT_DATE(), ISOWEEK)
Editable Google Data Studio Report and a GIF to elaborate:
It cannot set single dynamic value with straightforward way as text in GDS now.
But, you can use normal Table tool of GDS with single row, and it will show as single dynamic value that you need. Scorecard can also be used.
Here is how-to of using Table.
Under Data menu, set the date column that you want to display in Dimension, and do not set Metric. Also, choose Rows per page as 1.
Under Style menu, uncheck the Show header checkbox, Rows numbers checkbox and Shows pagination checkbox.
When you view the report, it will show as text.

Power BI convert eight digit yyyymmdd to date using DAX

I'm trying to convert eight digit yyyymmdd to date format with DAX function.
column = DATE(LEFT(TABLE[COLUMN],4),MID(TABLE[COLUMN],5,2),RIGHT(TABLE[COLUMN],2))
However, I've got an error because of the original column has some records with "00000000", so how can I make a default value with IF statement or are there any better solution?
Best regards
What I typically do is just make 2 distinct Power Query steps and this is handled automatically.
just make the yyyymmdd column a text column
make the text column from step 1 a date column (when prompted, be sure to select 'Add New Step')
replace errors with null
That's it. You can even Ctrl-Click to select multiple columns and combine them into the 1,2, and 3 steps with multiple columns.
Please check out "ferror" function IFERROR(value, value_if_error) for more information please visit Microsoft MSDN with link below
https://msdn.microsoft.com/en-us/library/ee634765.aspx
column = IFERROR( DATE(LEFT(TABLE[COLUMN],4),MID(TABLE[COLUMN],5,2),RIGHT(TABLE[COLUMN],2)), DATE(yyyy,mm,dd))

Data Type Cast Won't Stick in SSIS

I'm trying to automate a process with SSIS that exports data into a flat file (.csv) that is then saved to a directory, where it will be scanned and imported by some accounting software. The software (unfortunately) only recognizes dates that are in MM/DD/YYYY fashion. I have tried every which way to cast or convert the data pulled from SQL to be in the MM/DD/YYYY, but somehow the data is always recognized as either a DT_Date or DT_dbDate data type in the flat file connection, and saved down as YYYY-MM-DD.
I've tried various combinations of data conversion, derived columns, and changing the properties of the flat file columns to string in hopes that I can at least use substring operations to get this formatted correctly, but it never fails to save down as YYYY-MM-DD. It is truly baffling. The preview in the OLE DB source will show the dates as "MM/DD/YYYY" but somehow it always changes to "YYYY-MM-DD" when it hits the flat file.
I've tried to look up solutions (for example, here: Stubborn column data type in SSIS flat flat file connection manager won't change. :() but with no luck. Amazingly if I merely open the file in Excel and save it, it will then show dates in a text editor as "MM/DD/YYYY", only adding more mystery to this Bermuda Triangle-esque caper.
If there are any tips, I would be very appreciative.
This is a date formatting issue.
In SQL and in SSIS, dates have one literal string format and that is YYYY-MM-DD. Ignore the way they appear to you in the data previewer and/or Excel. Dates are displayed to you based upon your Windows regional prefrences.
Above - unlike the US - folks in the UK will see all dates as DD/MM/YYYY. The way we are shown dates is NOT the way they are stored on disk. When you open in Excel it does this conversion as a favor. It's not until you SAVE that the dates are stored - as text - according to your regional preferences.
In order to get dates to always display the same way. We need to save them not as dates, but as strings of text. TO do this, we have to get the data out of a date column DT_DATE or DT_DBDATE and into a string column: DT_STR or DT_WSTR. Then, map this new string column into your csv file. Two ways to do this "date-to-string" conversion...
First, have SQL do it. Update your OLE DB Source query and add one more column...
SELECT
*,
CONVERT(VARCHAR(10), MyDateColumn, 101) AS MyFormattedDateColumn
FROM MyTable
The other way is let SSIS do it. Add a Derived Column component with the expression
SUBSTRING([MyDateColumn],6,2) + "/" + SUBSTRING([MyDateColumn],8,2) + "/" + SUBSTRING([MyDateColumn],1,4)
Map the string columns into your csv file, NOT the date columns. Hope this helps.
It's been a while but I just came across this today because I had the same issue and hope to be able to spare someone the trouble of figuring it out. What worked for me was adding a new field in the Derived Column transform rather than trying to change the existing field.
Edit
I can't comment on Troy Witthoeft's answer, but wanted to note that if you have a Date type input, you wouldn't be able to do SUBSTRING. Instead, you could use something like this:
(DT_WSTR,255)(MONTH([Visit Date])) + "/" + (DT_WSTR,255)(DAY([Visit Date])) + "/" + (DT_WSTR,255)(YEAR([Visit Date]))

Google Drive form answers are not dates in the spreadsheet

I created a simple form with in Google Drive. The User choose a Date and a checkbox. In further calculations I have to compare the "date". But in the answers it isnĀ“t shown as a date. I can set the format of the column to date and everything is fine, but all the new answers dont have a format.
The formated dates are aligned left in the sheat and all the new unformated dates a right aligned.
Is there any script wich converts new dates to the right format? Or any other suggestions?
cheers
I have created an auxiliary column. There I enter the following formula in the second row. This is filled in automatically for all following lines.
The date is on the "C" column.
=ArrayFormula( IFERROR( if(C2:C<>0;(TEXT(day(C2:C);"00")&"."&text(month(C2:C);"00")&"."&YEAR(C2));"")))