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
who can help me?
I have a table like this:
Employee id | typy | date | time |
1010 | Enty | 8/31/2020 | 7:30:00 AM |
1010 | exit | 8/31/2020 | 8:34:26 AM |
1010 | entry | 8/31/2020 | 8:36:14 AM |
1010 | exit | 8/31/2020 | 12:36:21 PM |
123 | Enty | 8/31/2020 | 7:45:16 AM |
123 | exit | 8/31/2020 | 9:45:16 AM |
123 | entry | 8/31/2020 | 9:55:16 AM |
123 | exit | 8/31/2020 | 4:55:16 PM |
123 | Enty | 8/31/2020 | 5:10:16 PM |
123 | exit | 8/31/2020 | 8:14:56 PM |
4020 | entry | 8/31/2020 | 6:14:56 PM |
4020 | exit | 8/31/2020 | 7:14:56 PM |
4020 | entry | 8/31/2020 | 7:19:51 PM |
4020 | exit | 8/31/2020 | 8:14:56 PM |
4020 | entry | 8/31/2020 | 8:24:56 PM |
4020 | exit | 9/1/2020 | 1:14:56 AM |
and i need to calculate networking hours per day for each employee ID
NOTE : FOR THIRD SHIFT Exit date is = entry day +1
thanks
@Anonymous , In case of date-time is not a single column have one column like
date time =[date] +[time]
Create a new column , that will timefrom entry to exit
if([type] ="exit", datediff(maxx(filter(Table, [Employee id] =earlier([Employee id]) && [date time] <earlier([date time]) && [type] <> earlier([type] )),[date time] ),[date time] ,hour),blank())
@Anonymous I created something for that once: https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Duration-Working-Hours/m-p/481543#M182
In your case, you will also need to find the right time pairs, you can do that with the techinques in MTBF. See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586.
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __Previous = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Value])
RETURN
__Current - __Previous
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |