cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
n8greene
Level: Powered On

Formatting a date value from a column that might have a null value

Scenario: I am creating a CSV from a SharePoint list. One of the columns, StartDate, is sometimes blank. The date needs to be formatted. 

 

To get around the NULL error this works: Coalesce(item()?['StartDate']) BUT I need to format the date. 

I can format the date this way: formatDateTime(item()?['StartDate'],'yyyy-MM-dd') BUT then I get NULL errors. 

 

I cannot figure out how to avoid NULL errors AND format the date. Any suggestions?

 

These do NOT work: 

formatDateTime(coalesce(item()?['StartDate']),'yyyy-MM-dd')

coalesce(formatDateTime(item()?['StartDate'],'yyyy-MM-dd'))

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
n8greene
Level: Powered On

Re: Formatting a date value from a column that might have a null value

I kept experementing with different approaches and this worked:

 

if(equals(item()?['StartDate'], null), '', formatDateTime(item()?['StartDate'],'yyyy-MM-dd'))

 

(note that the '' in the formula is two single quotes)

View solution in original post

1 REPLY 1
Highlighted
n8greene
Level: Powered On

Re: Formatting a date value from a column that might have a null value

I kept experementing with different approaches and this worked:

 

if(equals(item()?['StartDate'], null), '', formatDateTime(item()?['StartDate'],'yyyy-MM-dd'))

 

(note that the '' in the formula is two single quotes)

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Coming Soon: T-shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors
Users online (6,350)