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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
itchyeyeballs
Impactful Individual
Impactful Individual

Compare DateTime to Text

Hi All,

 

I'm trying to manually specify a datetime to use in a formula but can't get it to work, I orignially used the datevalue function but have discovered it ignores the time.

 

My measure is

 

=calculate(
	[Measure1],
		Table1[startdate]<="20/02/15 12:00:00"
		,Table1[enddate]>="2016/02/15 12:00:00"
		,Table1[Application_date]<datevalue("2017/02/16")
		,Table1[year] ="17/18"
)

Any idea how I can work around this? Its crusical that the time is used as the records can change several times a day so we need to specify a time down to the second.

 

Any help appreciated

 

1 ACCEPTED SOLUTION
itchyeyeballs
Impactful Individual
Impactful Individual

THnk I answered my own question, I used:

 

<Date(2017,2,16) + Time(12,00,0) which seems to have worked

View solution in original post

4 REPLIES 4
itchyeyeballs
Impactful Individual
Impactful Individual

THnk I answered my own question, I used:

 

<Date(2017,2,16) + Time(12,00,0) which seems to have worked

you can always use this as well

 

 

 < DATEVALUE("2017-02-16 12:00:00")

 

 

Not sure if that is any easier for you to create in your code


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@Phil_Seamark

 

That would have been a bit easier and was what I tried initially, however after much headscratching I found a section in the docs that confirmed it ignores the time element (strangely it still throws an error if you input an ilegal time)

Hi @itchyeyeballs,

DATEVALUE(date_text) 

Yes, time information in the date_text argument is ignored according to the official article.

As you have use a workaround to solve this issue, you can accept your reply as solution, this way, other community members would easily find the solution when they get same issues.

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors