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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
NazeefKhan19
Frequent Visitor

Cannot get all dates from a certain date to todays date

I am trying to get dates from an admission date to todays date to go into a custom coumn using the following:

 

{ Number.From([admissionDate])..Number.From(DateTime.Date(DateTime.LocalNow)) } 

 

However the custom column i am adding is coming up with an Error which says :

 

'Expression.Error: The DateTime.Date function expects an input of type DateTime or DateTimeZone.
Details:
[Function]'

 

I thought that DateTime.LocalNow did return the date as of now in a date time format? 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

Are you looking for datediff or Dates.

In M

=each Duration.Days([Date1] - [Date2])

 

In dax date diff a new column

datediff([admission date],today(),day)

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

TomMartens
Super User
Super User

Hey @NazeefKhan19 ,

 

you have to use parenthesis in combination with DateTime.LocalNow as it is a function like so:

Number.From(DateTime.Date(DateTime.LocalNow()))

 

Hopefully, this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey @NazeefKhan19 ,

 

you have to use parenthesis in combination with DateTime.LocalNow as it is a function like so:

Number.From(DateTime.Date(DateTime.LocalNow()))

 

Hopefully, this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi @TomMartens 

If i am doing the following to get dates between two dates. How do i replace the 'DischargeDate' with today's date if its null?

{ Number.From([AdmissionDate]) ..Number.From([DischargeDate])  }

amitchandak
Super User
Super User

Are you looking for datediff or Dates.

In M

=each Duration.Days([Date1] - [Date2])

 

In dax date diff a new column

datediff([admission date],today(),day)

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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