Stop Powerbi changing date format when converting to text - powerbi

I am trying to convert a date column to text without changing the date format. I am currently doing this by changing the formatting of that column under the modelling header. The date format is currently DD/MM/YYYY which is what I want. However, when I change the formatting to text it changes the format to MM/DD/YYYY.
My regional settings are set to English(United Kingdom). Any other suggestions as to how I can have exactly the same column but as text rather than date?

I'd recommend the FORMAT function in a calculated column:
FORMAT(Table1[Date], "dd/mm/yyyy")

Related

Date format in Google Cloud Storage changes date to YYYY-DD-MM format

I upload data to Google Cloud Storage from CSV. The data in CSV is in dd/mm/yyyy format (in my example it is 05/09/2022 or 5th of September) and according to the metadata settings, I can see the default date is mm/dd/yyyy and it reads the date as 9th of May. How can I solve this issue and make GCP to read the date in dd/mm/yyyy format?
You can do this at the query level only. There is no way to change the format directly.
Also as mentioned above in comments, the custom time field does not represent the date format of the underlying data. You can refer to this document.
According to the documentation,format string represents the textual form of date and time and contains separate format elements that are applied left-to-right. Load the csv with all date columns as string, and parse them manually as date in a query.
Additionally you can check this stackoverflow link1 & link2

Zulu time conversion in a calculated table

I'm using PowerBI to build a calculated table to do time calculation on an existing table.
calc_issues = CALCULATETABLE(
SELECTCOLUMNS('public issues', "created_at_dt", 'public issues'[created_at], "closed_at_dt", 'public issues'[closed_at]))
Both these columns are text in my original database and are imported as text in this calculated table. When I try to switch this calculated table into a Date/Time I get the following issue:
Cannot convert value '2021-09-09T14:55:11Z' of type Text to type Date while processing column.
Now if I go into my database table and convert the text into Date/Time there's error. But I want this new calculated table to show specific Date/Time calculations.
When I try to create a new column and try to do a DATEVALUE on the text I get the same error.
Solution: Power Editor doesn't modify the existing database table when using direct.
The query editor can be used to convert the text into time stamps. I loaded your data sample into Power Query in a blank query and it was converted automatically, even converting Zulu to my local time.
If you don't want to convert to local time, then remove the Z from the text by extracting the first 19 characters of the text, then change the data type.

Power Bi date error when importing excel file

SO when I import this excel file with invoice_date column as 12/1/2010 8:26 there is an error popup and when I click on view errors it takes me to Power Query Editor where all the values in the date column are displayed as an error.
I tried changing type using Locale but it didn't work.
you may try changing Windows Regional settings.
day/month/year
https://support.microsoft.com/en-us/office/change-the-windows-regional-settings-to-modify-the-appearance-of-some-data-types-edf41006-f6e2-4360-bc1b-30e9e8a54989?ui=en-us&rs=en-us&ad=us
Is there data formatted in excel as a date? If so, change it to text and import again. that way you can try and convert to datetime field from there and get more information on why it isnt converting if it doesnt.
Also, review your data. Has something got into the datetime column that isnt datetime?
You can avoid this by splitting the date/time column in the PowerQuery transform stage in a Date column and a Time column.

how can i change the format of the date by using Format Function , DAX , Power BI?

I have a column "Sta" type date/time, and I want to change the format of it to be like this format "YYYYMM", or "MM-YYYY" into a new column.
and this error appears to me each time I want to change the format of the column into the new one !!!!
any idea how can I change the format by using the Format Function?
It's explicitly stated in the documentation that FORMAT function is not supported for use in DirectQuery mode. Also take a look at DAX formula compatibility in DirectQuery mode article.
The format function you use expect just one row. With a Max() function before it will work.
However, what you are looking for is in the relationship tab:
Click on your date column then go to Properties > Date time Format > Custom Format:
Here you can type in your custom format.

Duration wrongly converted to Date-Time type

I am getting data from an excel file which include a column which shows duration as mm:ss:ms
But when I import the data to Power BI Desktop with Power Query, it converts this column to date/time format.
I don't know how can I solve this issue.
Any idea?
I already tried the code below:
format(((TableName[Duration] / 60)/60)/24, "HH:mm:ss")
and already tried to change the source column type from the excel to general.
PowerBI does not currently support milliseconds in date time datatype. You can convert the excel doc to general, load it into PowerBI, and multiply the value by 86400 to get the total number of seconds. Otherwise you'll need to bring it in as a string and do string manipulations to pull out the information you want.
Hope it helps.