The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi everyone,
I've struggling with this one. Need help to write a measure or column to calculate a duration time.
I have a table called TCensus with a column named "Admit Date & time", a column named "Discharge date & time", and column called " HourLogged Time", which is the differentce bewteen "Admit Date & time" and "Discharge date & time", there could be multiple rows that have the same Admit Date but with different admit time. I need to create a column or measure that only shows "" HourLogged Time" on the row where has the least HourLogged time on each Admit date. otherwise it will be 0.
see expected outcome below
For example, ""Admit Date & time" = Feb 1, there are 3 patient admitted at different time on Feb 1, the one in the red box has a duration(Hourlogged time) of 32 hours (differentce bewteen "Admit Date & time" and "Discharge date & time",) is overlapped with rest the 2 patients. I would like to only show 32 hours as the overlapped time on Feb 1. For other 2 patients on that day, showing 0.
Your help is greatly appreciated!!
Thanks
I think it is more tricky. I now calculated the count of ppl per datetime event (dicharge or admin, it is is not 100 % perfect now, because i look dirctly at the discharge and admin event and you have to decide the "<" or "<=")
You see during the 1. Feb the count of ppl increase. The first persons leaving at 15:15 of 2. Feb. and the count of ppl decrease. Your mentioned overlapping time will be this time part. But the count of ppl is decreasing earlier.
I also put in the 2. overlapping duration:
I put your third overlapping duration in the diagram:
I think you have to thinking twice about this logic. I see big interpretations problems right now.
Also the calculations logic is not clear enough.
Proud to be a Super User!
Thank you for your reply 🙂
It seems so that you want to calculated for a complete day the overlapping time. Is the count of people important when the overlapping time happenend? My logic will be do look during the day when the maximum of ppl for this day are reached and how long. I will try also to find out which person it is. Very interesting question 🙂
Proud to be a Super User!
Regardless of how many people on the same day, all I want is to calculate the overlapping time by each single day. Like highlighted in the red box blow, Admit date as Feb 1, the overlapping duration is 32 hours.
Can you first please send a table (with the table function of the forum) with some data examples. I do not want to copy it manually. I think the logic in general with the overlapping time is difficult. Think about the following example, what is now the overlapping time?
What is if you have 7 persons and only 5 h overlapping time, in the rest of the time 6 person complete overlapping?
I want to say that you may have to think about the meaning of this overlapping time and the usage of it.
Proud to be a Super User!
HI @andhiii079845 ,
Thanks for your fast reply, please see below my data table,
To answer your question, in case of 7 people, only 5 are overlapped, then i just need to know the overlapping time of the 5.
I guess what i want to achieve is that to calculate the overlapping time if exists,
ID | Admit Date | Admit Date & Time | Discharge Date | Discharge Date & Time | Admit Time | Discharge Time | HourLogged Time |
1 | 1-Feb-22 | 2/1/2022 7:24 | 4-Feb-22 | 2/4/2022 13:30 | 7:24:32 AM | 1:30:00 PM | 78 |
2 | 1-Feb-22 | 2/1/2022 7:41 | 2-Feb-22 | 2/2/2022 16:30 | 7:41:07 AM | 4:30:00 PM | 33 |
3 | 1-Feb-22 | 2/1/2022 8:39 | 2-Feb-22 | 2/2/2022 16:00 | 8:39:19 AM | 4:00:00 PM | 32 |
4 | 2-Feb-22 | 2/2/2022 7:19 | 2-Feb-22 | 2/2/2022 15:15 | 7:19:33 AM | 3:15:00 PM | 8 |
5 | 2-Feb-22 | 2/2/2022 8:20 | 3-Feb-22 | 2/3/2022 10:45 | 8:20:12 AM | 10:45:00 AM | 26 |
6 | 2-Feb-22 | 2/2/2022 10:21 | 4-Feb-22 | 2/4/2022 12:50 | 10:21:36 AM | 12:50:00 PM | 50 |
7 | 8-Feb-22 | 2/8/2022 6:55 | 8-Mar-22 | 3/8/2022 12:15 | 6:55:10 AM | 12:15:00 PM | 678 |
8 | 8-Feb-22 | 2/8/2022 7:13 | 12-Feb-22 | 2/12/2022 9:30 | 7:13:30 AM | 9:30:00 AM | 98 |
9 | 9-Feb-22 | 2/9/2022 7:04 | 12-Feb-22 | 2/12/2022 19:30 | 7:04:36 AM | 7:30:00 PM | 84 |
10 | 9-Feb-22 | 2/9/2022 7:44 | 12-Feb-22 | 2/12/2022 16:45 | 7:44:42 AM | 4:45:00 PM | 81 |
11 | 9-Feb-22 | 2/9/2022 7:51 | 10-Feb-22 | 2/10/2022 12:00 | 7:51:25 AM | 12:00:00 PM | 29 |
12 | 10-Feb-22 | 2/10/2022 9:09 | 13-Feb-22 | 2/13/2022 19:32 | 9:09:29 AM | 7:32:00 PM | 82 |
13 | 11-Feb-22 | 2/11/2022 6:51 | 16-Feb-22 | 2/16/2022 10:30 | 6:51:00 AM | 10:30:00 AM | 124 |
14 | 12-Feb-22 | 2/12/2022 14:28 | 19-Feb-22 | 2/19/2022 10:00 | 2:28:59 PM | 10:00:00 AM | 164 |
15 | 14-Feb-22 | 2/14/2022 6:51 | 19-Feb-22 | 2/19/2022 11:45 | 6:51:43 AM | 11:45:00 AM | 125 |
16 | 14-Feb-22 | 2/14/2022 8:44 | 15-Feb-22 | 2/15/2022 16:30 | 8:44:31 AM | 4:30:00 PM | 32 |
17 | 15-Feb-22 | 2/15/2022 12:02 | 19-Feb-22 | 2/19/2022 13:30 | 12:02:57 PM | 1:30:00 PM | 97 |
18 | 16-Feb-22 | 2/16/2022 6:32 | 17-Feb-22 | 2/17/2022 17:50 | 6:32:03 AM | 5:50:00 PM | 35 |
19 | 16-Feb-22 | 2/16/2022 8:09 | 18-Feb-22 | 2/18/2022 17:50 | 8:09:08 AM | 5:50:00 PM | 57 |
20 | 17-Feb-22 | 2/17/2022 7:57 | 21-Feb-22 | 2/21/2022 14:10 | 7:57:58 AM | 2:10:00 PM | 103 |
21 | 17-Feb-22 | 2/17/2022 8:06 | 17-Feb-22 | 2/17/2022 12:00 | 8:06:09 AM | 12:00:00 PM | 4 |
22 | 18-Feb-22 | 2/18/2022 7:34 | 19-Feb-22 | 2/19/2022 18:00 | 7:34:19 AM | 6:00:00 PM | 35 |
23 | 21-Feb-22 | 2/21/2022 8:42 | 22-Feb-22 | 2/22/2022 13:00 | 8:42:47 AM | 1:00:00 PM | 29 |
24 | 21-Feb-22 | 2/21/2022 9:00 | 22-Feb-22 | 2/22/2022 14:15 | 9:00:04 AM | 2:15:00 PM | 29 |
25 | 21-Feb-22 | 2/21/2022 11:26 | 22-Feb-22 | 2/22/2022 9:40 | 11:26:21 AM | 9:40:00 AM | 22 |
26 | 22-Feb-22 | 2/22/2022 7:09 | 26-Feb-22 | 2/26/2022 11:00 | 7:09:52 AM | 11:00:00 AM | 100 |
27 | 22-Feb-22 | 2/22/2022 9:46 | 23-Feb-22 | 2/23/2022 19:05 | 9:46:56 AM | 7:05:00 PM | 34 |
28 | 23-Feb-22 | 2/23/2022 6:44 | 26-Feb-22 | 2/26/2022 14:00 | 6:44:48 AM | 2:00:00 PM | 80 |
29 | 23-Feb-22 | 2/23/2022 8:51 | 25-Feb-22 | 2/25/2022 17:10 | 8:51:43 AM | 5:10:00 PM | 57 |
30 | 24-Feb-22 | 2/24/2022 6:55 | 28-Feb-22 | 2/28/2022 13:15 | 6:55:30 AM | 1:15:00 PM | 103 |
31 | 24-Feb-22 | 2/24/2022 10:16 | 27-Feb-22 | 2/27/2022 11:30 | 10:16:07 AM | 11:30:00 AM | 73 |
32 | 25-Feb-22 | 2/25/2022 6:56 | 7-Mar-22 | 3/7/2022 6:30 | 6:56:51 AM | 6:30:00 AM | 240 |
33 | 25-Feb-22 | 2/25/2022 7:20 | 25-Feb-22 | 2/25/2022 18:20 | 7:20:10 AM | 6:20:00 PM | 11 |