Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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?
Solved! Go to Solution.
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)
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
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
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]) }
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)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 104 | |
| 81 | |
| 66 | |
| 50 | |
| 45 |