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
ericOnline
Post Patron
Post Patron

Cannot convert null to timestamp

Hello,

I have a column of timestamps in Unix format. Many of the values are null. I don't want to drop nulls because the records they pertain to are critical. 

How do I handle these nulls and still convert this column to a timestamp using a Custom Column with the following code?:

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

 Thank you

1 ACCEPTED SOLUTION

@ericOnline, try how

if [unixTimestampColumn] is null, then null else #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 8, 0,[unixTimestampColumn]/1000)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
ericOnline
Post Patron
Post Patron

UPDATE1

- I first replaced all nulls with 0. Thid did not work.

- I then replaced all nulls with 000000000000 and even though the column still showed "0", the conversion worked.

 

NEXT QUESTION:

- I now have a bunch of values with 1/1/1970 (the beginning of Unix epoch).

- What are some ideas for hiding these values in the visualization? 

  - For example: I don't want the user to see "1/1/1970" as an option in any date slicers.

(Reminder: I can't just drop these records because other columns are critical).

Thank you

@ericOnline, try how

if [unixTimestampColumn] is null, then null else #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 8, 0,[unixTimestampColumn]/1000)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.