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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How can I match datetimes with dates?

Hello

 

I have this data:

 

Col1Col2Col3Col4
A01/01/2021 01:3001/01/20211
A01/01/2021 02:3001/01/20211
A01/01/2021 03:3001/01/20211
B01/01/2021 01:3001/01/20212
B01/01/2021 02:3001/01/20212
B01/01/2021 03:3001/01/20212

 

I create a time graph using Col2 but I want to use in a Measure the Col4 where the date of Col2 = Col3. The think is that if I do that, it returns a whole column of three values from Col4 so I either need the max/avg of them or only the first value.

 

Any idea how to do that?

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

About matching datetimes with dates, you can do the following.

 

Column = IF(DATE(YEAR([Col2]),MONTH([Col2]),DAY([Col2]))=[Col3],"Y","N")

 

vstephenmsft_0-1640843707114.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

About matching datetimes with dates, you can do the following.

 

Column = IF(DATE(YEAR([Col2]),MONTH([Col2]),DAY([Col2]))=[Col3],"Y","N")

 

vstephenmsft_0-1640843707114.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AllisonKennedy
Super User
Super User

@Anonymous  Yes, it must aggregate somehow so not sure exactly what your requirement is? Can you describe or draw your desired result further?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.