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

View all the Fabric Data Days sessions on demand. View schedule

Reply
fowl04
Frequent Visitor

Help with Epoch Time conversion

Hello. So I am converting epoch time to standard time and date format but I have some cells that are blank and the conversion is returning 1/1/1970. How can i prevent it from doing that. I want it to show a blank if the cell is blank but not 1/1/1970. Here are screen shots of what it is doing and what I have.

 

fowl04_0-1673817459865.pngfowl04_2-1673817539893.png

So to sum it up. I want to convert cells that only have a value in it only and for it to ignore the blank cells.

 

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @fowl04 ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1673834599793.png

Please try to add a new column:

vjianbolimsft_1-1673834633906.png

Here is the M code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0Mzc2tTSAAKVYnWglJ6AomOEMY7jAGK5gDQZmRmZGJlANsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Epoch = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", type text}, {"Epoch", Int64.Type}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if [Epoch] = null then "" else #datetime(1970,1,1,0,0,0)+#duration(0,0,0,[Epoch]/1000))
in
    #"Added Conditional Column"

Final output:

vjianbolimsft_2-1673834682893.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @fowl04 ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1673834599793.png

Please try to add a new column:

vjianbolimsft_1-1673834633906.png

Here is the M code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0Mzc2tTSAAKVYnWglJ6AomOEMY7jAGK5gDQZmRmZGJlANsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Epoch = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", type text}, {"Epoch", Int64.Type}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if [Epoch] = null then "" else #datetime(1970,1,1,0,0,0)+#duration(0,0,0,[Epoch]/1000))
in
    #"Added Conditional Column"

Final output:

vjianbolimsft_2-1673834682893.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors