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.

Issues Adding Date and Time Values

Hello, so I am generating a report that display the average messages per hour per day. The main table involved is the table of messages with a creation datetime and other message properties. To get this I created a column that rounds down the datetime value to the start of the hour. I used the below formula for JustHour2 to originally calulate this. Unfortunatly when the expected time output of 1:00:00 AM should be returned I am instead getting 12:59:59 PM. After testing some things I found out if I add the date to the time instead of vice versa I get the expected output of 1:00:00 AM. I have inclu.ded below some sample data along with the formula. As far as I can tell it is not limited to the Desktop version of Power BI

 

JustHour = TIME(HOUR(data_Message[CreateDateTime]),0,0) + DATE(YEAR(data_Message[CreateDateTime]),MONTH(data_Message[CreateDateTime]),DAY(data_Message[CreateDateTime]))
JustHour2 = DATE(YEAR(data_Message[CreateDateTime]),MONTH(data_Message[CreateDateTime]),DAY(data_Message[CreateDateTime])) + TIME(HOUR(data_Message[CreateDateTime]),0,0)
 
CreateDateTimeJustHourJustHour2
2/21/20 2:29 PM2/21/20 2:00 PM2/21/20 2:00 PM
2/21/20 2:18 PM2/21/20 2:00 PM2/21/20 2:00 PM
2/21/20 2:08 PM2/21/20 2:00 PM2/21/20 2:00 PM
2/21/20 1:54 PM2/21/20 1:00 PM2/21/20 12:59 PM
2/21/20 1:52 PM2/21/20 1:00 PM2/21/20 12:59 PM
Status: New
Comments
v-qiuyu-msft
Community Support

Hi @Camochase

 

Based on my test in Power BI Desktop version 2.78.5740.861 64-bit (February 2020), the JustHour2 returns expected results. Please update your Power BI desktop to the same version as ours then test again. 

 

q2.PNG

 

Best Regards,
Qiuyun Yu

Camochase
New Member

Qiuyun,

 

It looks as though I was already on the newest update. In addition when I open up my original file the results are still messed up. 

 

 

Capture.PNG