Can Powerpivot transform this data

bertusavius

Board Regular
Joined
Feb 28, 2008
Messages
82
I have a source table that contains time information about shifts people work:
EFGH
37Source Table
38namedatestart-timestop-time
39John1-1-201213:0015:45
40Frank15-8-20128:4510:30

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Blad4



I would like to transform this information into a pivot table using PowerPivot in order to get the following result:
NOPQ
28Pivot Table
29JohnFrankJames
301-1-2012
311300-14001:00
321400-15001:00
331500-16000:45
3415-8-2012
350800-09000:15
360900-10001:00
371000-11000:30

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Blad4



What would be a good way to approach this problem?
 
Have you checked that the dates are correct?

After seeing your model, I suggest you add a date dimension to your model (with year, month, day name, ...) instead of adding them as separate tables.

You might as well add a calculated column directly in the model, for the end date.

Also, in the file you sent, the very last bucket was not correct (23:00 to 00:00 instead of 23:00 to 24:00), resulting in lost data.
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Just here to let you know that the problem is sufficiently solved.

In the end I also needed to subtract some time for each shift (pauze).
I also added a column that defines the date for buckets of shifts that run past midnight.


=SUMX(
CROSSJOIN('Tabel13';'Tijd');

(if(or(Tabel13[Starttijd]>= ((1/24)*4);Tabel13[Starttijd] > Tabel13[Stoptijd]);
IF(AND(
IF(Tabel13[Starttijd]<((1/24)<wbr>*4);Tabel13[Starttijd]+1;<wbr>Tabel13[Starttijd]) < IF(Tijd[Eind tijd]<=(1/24*4);Tijd[Eind tijd]+1;Tijd[Eind tijd])
;
IF(Tabel13[Stoptijd]<=(1/24*<wbr>4);Tabel13[Stoptijd]+1;<wbr>Tabel13[Stoptijd]) > IF(Tijd[Start tijd]<(1/24*4);Tijd[Start tijd]+1;Tijd[Start tijd])
)
;
if(IF(Tabel13[Stoptijd]<=(1/<wbr>24*4);Tabel13[Stoptijd]+1;<wbr>Tabel13[Stoptijd]) > IF(Tijd[Eind tijd]<=(1/24*4);Tijd[Eind tijd]+1;Tijd[Eind tijd])
;
IF(Tijd[Eind tijd]<=(1/24*4);Tijd[Eind tijd]+1;Tijd[Eind tijd])
;
IF(Tabel13[Stoptijd]<=(1/24*4)<wbr>;Tabel13[Stoptijd]+1;Tabel13[<wbr>Stoptijd])
)
-
IF(IF(Tabel13[Starttijd]<((1/<wbr>24)*4);Tabel13[Starttijd]+1;<wbr>Tabel13[Starttijd]) > IF(Tijd[Start tijd]<(1/24*4);Tijd[Start tijd]+1;Tijd[Start tijd])
;
IF(Tabel13[Starttijd]<((1/24)<wbr>*4);Tabel13[Starttijd]+1;<wbr>Tabel13[Starttijd])
;
IF(Tijd[Start tijd]<(1/24*4);Tijd[Start tijd]+1;Tijd[Start tijd])
)
;
0
)
;
IF(AND( Tabel13[Starttijd] < Tijd[Eind tijd]
;Tabel13[Stoptijd] > Tijd[Start tijd]
)
;
if(Tabel13[Stoptijd] < Tijd[Eind tijd];Tabel13[Stoptijd];Tijd[<wbr>Eind tijd])
-
if(Tabel13[Starttijd] > Tijd[Start tijd];Tabel13[Starttijd];Tijd[<wbr>Start tijd])
;
0
)
)
-
if(or(Tabel13[Starttijd]>= ((1/24)*4);Tabel13[Starttijd] > Tabel13[Stoptijd]);
IF(AND(
IF(Tabel13[Starttijd]<((1/24)<wbr>*4);Tabel13[Starttijd]+1;<wbr>Tabel13[Starttijd]) < IF(Tijd[Eind tijd]<=(1/24*4);Tijd[Eind tijd]+1;Tijd[Eind tijd])
;
IF(Tabel13[Stoptijd]<=(1/24*<wbr>4);Tabel13[Stoptijd]+1;<wbr>Tabel13[Stoptijd]) > IF(Tijd[Start tijd]<(1/24*4);Tijd[Start tijd]+1;Tijd[Start tijd])
)
;
if(IF(Tabel13[Stoptijd]<=(1/<wbr>24*4);Tabel13[Stoptijd]+1;<wbr>Tabel13[Stoptijd]) > IF(Tijd[Eind tijd]<=(1/24*4);Tijd[Eind tijd]+1;Tijd[Eind tijd])
;
IF(Tijd[Eind tijd]<=(1/24*4);Tijd[Eind tijd]+1;Tijd[Eind tijd])
;
IF(Tabel13[Stoptijd]<=(1/24*4)<wbr>;Tabel13[Stoptijd]+1;Tabel13[<wbr>Stoptijd])
)
-
IF(IF(Tabel13[Starttijd]<((1/<wbr>24)*4);Tabel13[Starttijd]+1;<wbr>Tabel13[Starttijd]) > IF(Tijd[Start tijd]<(1/24*4);Tijd[Start tijd]+1;Tijd[Start tijd])
;
IF(Tabel13[Starttijd]<((1/24)<wbr>*4);Tabel13[Starttijd]+1;<wbr>Tabel13[Starttijd])
;
IF(Tijd[Start tijd]<(1/24*4);Tijd[Start tijd]+1;Tijd[Start tijd])
)
;
0
)
;
IF(AND( Tabel13[Starttijd] < Tijd[Eind tijd]
;Tabel13[Stoptijd] > Tijd[Start tijd]
)
;
if(Tabel13[Stoptijd] < Tijd[Eind tijd];Tabel13[Stoptijd];Tijd[<wbr>Eind tijd])
-
if(Tabel13[Starttijd] > Tijd[Start tijd];Tabel13[Starttijd];Tijd[<wbr>Start tijd])
;
0
)


)*(if(isblank(Tabel13[Pauze])<wbr>;0;(Tabel13[Pauze]/60) / (Tabel13[Gewerkt] + (Tabel13[Pauze]/60)))))
 
Upvote 0

Forum statistics

Threads
1,217,060
Messages
6,134,345
Members
449,869
Latest member
andrewtbi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top