I have two different DateTime columns with the same format date. "Created_datetime" is well recognized by data studio as a date). "paid_datetime" will contain some empty value, Data Studio does not recognize it as date but as text. Data table shown below.
After my research, I apply "TODATE" function as
TODATE(paid_datetime, "%d/%m/%Y %H:%M", "%d%m%Y%H%M")

But after applying the filter "Date Range Control", the "total_selling" and "grand_total" did not match the correct results. May I know any solution for this issue?

Appreciate for help! Thank you! Detail Provided below:
1.)Public Editable DataStudio Report Link:
https://datastudio.google.com/reporting/a3067f59-b01a-411c-aab8-4f930495cf2a
2.) Example Datatable
| id | total_selling | grand_total | paid_datetime | Created_datetime |
|---|---|---|---|---|
| 1 | 10 | 11 | 23/6/2022 23:22 | 17/3/2021 14:34 |
| 2 | 17/3/2021 14:34 | |||
| 3 | 12 | 14 | 20/6/2022 20:22 | 17/4/2021 14:34 |
| 4 | 17/4/2021 14:34 | |||
| 5 | 12 | 14 | 10/6/2022 13:22 | 17/4/2021 14:34 |
| 6 | 10/4/2021 14:34 | |||
| 7 | 2 | 5 | 5/4/2022 21:22 | 10/4/2021 14:34 |
| 8 | 11 | 21 | 1/6/2022 2:33 | 30/5/2022 14:44 |
| 9 | 30/5/2022 14:44 |

0) Summary
Broken down into three sections:
TODATEcalculated field1) Issue at the Data Set
The issue stems from how the dates are formatted at the Google Sheets data set. While some values in the
paid_datetimefield were detected as dates (left aligned;idvalues 5, 7 and 8; highlighted in green, below), others were treated as plain text (right aligned;idvalues 2 and 4; highlighted red in the image below). Additionally, simply changing the format of the entire column to the date format also does not resolve the issue as the days and months have been identified in the reverse order for values currently in the date format (idvalues 5, 7 and 8; highlighted in orange, below):To explain created a new Google Sheet and added a column that uses the
ISDATEandCELLfunctions and highlighted the issues in red and orange:NOTE 1: for purposes of simplicity and avoiding confusion, focusing on a single date column, thus excluding the
Created_datetimefield.2) Issue with the current attempt
The problem with the calculated field in the question (named
TODATE_testingin the report) is two fold:2.1) Partial Date Recognition
The calculated field in the question and the respective output are:
It seems like Google Data Studio had recognised the cells that were in the Date format in Google Sheets (
idvalues 5, 7 and 8) and had attempted to turn it into the native format, thus why it has changed the format to:NOTE 2: the native format was meant to be "YYYY-MM-DD HH:MM:SS", however, in this case (again, the issue stems from the data set as highlighted in the first image), the day (DD) and month (MM) components were detected the other way round for some components (which is accounted for in the suggestion below)
2.2) Compatibility Date format
The
TODATEfunction is no longer recommended as of the 17 Sep 2020 update, which saw "New and improved date and time functions"; the top of the respective function page displays the following warning:3) Suggestion
As there are two different Date formats, the
CASEbelow ensures that each format is recognised using the thePARSE_DATETIMEfunction:The calculated field above (titled
Date_CASEin the report below) would also work if all the date values in the data column were formatted as expected at the data set (Dates in Google Sheets) or were all plain text values.Publicly editable Google Data Studio report (embedded Google Sheets data source) and a GIF to elaborate: