Forum Discussion
Minute in between timestamp
Hello,
Im wondering if this is possible, this is my table result.
So I have a Table with Column Timestamp on it. I create a new column to compute hour of the Timestamp column.
So when im summarizing the result, the Minutes(date diff max and min) shows incorrect. If you look below
hour 6 should by 60 since the we start at hour 5 and end on hour 8. is there a way to make Minute column compute as follows?
Hour 5 = 29
Hour 6 = 60
Hour 7 = 60
Hour 8 = 20
| BatchNumber | Hour | Date diff max and min |
| A | 5 | 29 |
| A | 6 | 59 |
| A | 7 | 57 |
| A | 8 | 20 |
I created a sample data. Where I assumed batch has a start and end time.
I also created time buckets of every hour
Then used CrossJoin to create a new table. (This can be imported for less number of columns)
and then calculated the hourly minutes
Refer to the table: 'Table' in the pbix , check the last 3 columns.
https://www.dropbox.com/s/5wo5jhzl488zy69/Minute_between%20Hours.pbix?dl=0
Table = filter(CROSSJOIN('time bucket','Batch'),('time bucket'[Start] <= 'Batch'[B End] && 'time bucket'[End] >= 'Batch'[B Start])) Final End = if('Table'[B End]<'Table'[End],'Table'[B End],'Table'[End]) Final Start = if('Table'[B Start]>'Table'[Start],'Table'[B Start],'Table'[Start]) Min Diff = DATEDIFF('Table'[Final Start],'Table'[Final End],MINUTE)Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
1 Reply
- amitchandak
Super User
I created a sample data. Where I assumed batch has a start and end time.
I also created time buckets of every hour
Then used CrossJoin to create a new table. (This can be imported for less number of columns)
and then calculated the hourly minutes
Refer to the table: 'Table' in the pbix , check the last 3 columns.
https://www.dropbox.com/s/5wo5jhzl488zy69/Minute_between%20Hours.pbix?dl=0
Table = filter(CROSSJOIN('time bucket','Batch'),('time bucket'[Start] <= 'Batch'[B End] && 'time bucket'[End] >= 'Batch'[B Start])) Final End = if('Table'[B End]<'Table'[End],'Table'[B End],'Table'[End]) Final Start = if('Table'[B Start]>'Table'[Start],'Table'[B Start],'Table'[Start]) Min Diff = DATEDIFF('Table'[Final Start],'Table'[Final End],MINUTE)Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin