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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Need help with transforming the Date

I have a few date fields that are coming from sql server and the data is retreived as a number and i tried to transform it to date but it is not working. 

Screenshot 2023-04-19 194432.jpg

 

I need help on how to transform this number to date. I have data coming from more than 10 tables and i dont want to use a direct SQL query as i have to face a different issue when i have to refresh the data in the future. 

when i ran the below query in SQL i got the dates correctly as they should.

SELECT [kee]
      ,CAST(DATEADD(SECOND, [created_at]/1000,'1970/1/1') AS DATE) createdDate
      ,CAST(DATEADD(SECOND, [updated_at]/1000,'1970/1/1') AS DATE) updateDate
      ,CAST(DATEADD(SECOND, [issue_creation_date]/1000,'1970/1/1') AS DATE) issueCreatedDate
      ,CAST(DATEADD(SECOND, [issue_update_date]/1000,'1970/1/1') AS DATE) issueUpdatedDate
      ,CAST(DATEADD(SECOND, [issue_close_date]/1000,'1970/1/1') AS DATE) issueClosedDate
FROM [XXXXXX].[dbo].[XXXXXX]

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

Here is the expression that you can use in query editor to add a new column convert from timestamp to datetime: (you only need to repalce the field to your timestamp field names)

 #datetime(1970,1,1,0,0,0) + #duration(0,0,0,[Field]/1000)

1.PNG

In addition, you can also try to use t-SQL query to replace values when you use the data connector that allow you to use SQL statement.

sql-server-advanced-optionsRegards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @Anonymous,

Here is the expression that you can use in query editor to add a new column convert from timestamp to datetime: (you only need to repalce the field to your timestamp field names)

 #datetime(1970,1,1,0,0,0) + #duration(0,0,0,[Field]/1000)

1.PNG

In addition, you can also try to use t-SQL query to replace values when you use the data connector that allow you to use SQL statement.

sql-server-advanced-optionsRegards,

Xiaoxin Sheng

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.