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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Lucylangers
New Member

Looking to return todays date in an if formula

Hi all, 

New to PowerBI but long time excel user - I am trying to create a custom column that returns todays date if the value in another column in null, and if not, returning a different date. The whole formula is working except for the todays date function (where I instead change this to a text return the whole thing works). I've tried representing it in multiple ways but to no success . Below is the current formula in PowerBI with the returning error. 

 

Lucylangers_0-1662542974535.png

Lucylangers_1-1662542990136.png

Any help would be really appreciated!!

 

Many thanks,

 

Lucy

 

 

2 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @Lucylangers 
Please replace TODAY ( ) with DateTime.LocalNow()

View solution in original post

Lucylangers
New Member

Thank you so much, I had tried to use datetime.localnow before but failed to realise I needed the () after! This works perfectly now. 

View solution in original post

3 REPLIES 3
Lucylangers
New Member

Thank you so much, I had tried to use datetime.localnow before but failed to realise I needed the () after! This works perfectly now. 

tamerj1
Super User
Super User

Hi @Lucylangers 
Please replace TODAY ( ) with DateTime.LocalNow()

Talib5651424
New Member

#if you need a date use Date.From()
Date.From(DateTime.LocalNow())

You should use this instad of TODAY()

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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