Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
TheAndy
New Member

Accepted datetime format?

So background: I have a dataset that updates daily via powershell. Currently the "Date" column in the table is actually stored as a string. This works but it's causing sorting issues (like 01/02/2020 appearing next to 01/02/2021 on graphs for example). 

 

I'm trying to recreate this table with a proper datetime column, but having no luck adding rows. I've tried all the common formats I can think of, from dd/MM/yyyy, MM/dd/yyyy, dd-MM-yyyy etc. I've even tried ISO 8601 formatting but whatever I try, my Add-PowerBIrow statement throws a "Operation returned an invalid status code 'BadRequest'" error. I know for a fact it's the datetime causing it as I have another test table set up that's perfectly happy accepting the same row when the column is set as a string.

 

So my question is, what is the correct format to use with a datetime data type? Any hints or assistance gratefully received...

1 ACCEPTED SOLUTION
TheAndy
New Member

NVM, worked it out. I forgot that adding -format to Get-Date in PS turns the output into a string rather than a datetime, so of course the data types wouldn't match.


[datetime]$date = Get-Date -format "whatever format you like" 

 

worked first time. 

View solution in original post

1 REPLY 1
TheAndy
New Member

NVM, worked it out. I forgot that adding -format to Get-Date in PS turns the output into a string rather than a datetime, so of course the data types wouldn't match.


[datetime]$date = Get-Date -format "whatever format you like" 

 

worked first time. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.

Top Kudoed Authors