SOLVED

Filtering Away Certain Duplicate Values in Pivot Data Source

%3CLINGO-SUB%20id%3D%22lingo-sub-2708952%22%20slang%3D%22en-US%22%3EFiltering%20Away%20Certain%20Duplicate%20Values%20in%20Pivot%20Data%20Source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2708952%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI'm%20using%20Pivot%20Table%20and%20Slicer%20to%20filter%20data%20from%20a%20raw%20data%20source.%20Our%20employees%20work%20rotating%20shifts.%20Between%20those%20shifts%20there%20are%20overlap%20hours.%20I%20created%20a%20file%20to%20track%20their%20performance%20during%20those%209%20hours%20of%20shifts.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMorning%20shift%3A%2008%3A00%20-%2017%3A00%3C%2FP%3E%3CP%3EMid%20Shift%20%3A%2016%3A00%20-%2001%3A00%3C%2FP%3E%3CP%3ENight%20Shift%20%3A%2023%3A30%20-%2008%3A30%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20using%20Slicer%20to%20select%20between%20shifts.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOur%20tool%20provides%20the%20raw%20data%20I%20need%20without%20separating%20shifts.%20So%20for%20overlap%20hours%20(16%3A00%20-%2017%3A00)%20we%20get%20duplicate%20data%20resulting%20in%20employees%20appearing%20in%20both%20morning%20and%20mid%20shift%20in%20the%20Pivot%20Table.%20What%20I%20want%20is%20to%20Excel%20to%20ignore%20the%20second%20data%20set%20for%20duplicate%20entries%20and%20not%20include%20them%20in%20the%20pivot.%20Is%20this%20possible%3F%20Or%20is%20there%20any%20other%20way%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAm%20I%20clear%20enough%3F%20If%20not%20I%20can%20provide%20more%20info.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20attaching%20the%20excel%20file%20I'm%20working%20on%20for%20you%20to%20see%20what%20I'm%20doing.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2708952%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2709458%22%20slang%3D%22en-US%22%3ERe%3A%20Filtering%20Away%20Certain%20Duplicate%20Values%20in%20Pivot%20Data%20Source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2709458%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1142876%22%20target%3D%22_blank%22%3E%40kheldar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENot%20with%20your%20dataset%20since%20it%20cannot%20actually%20tell%20which%20employee%20belongs%20to%20which%20actual%20shift%2C%20i.e%20Employee1%20might%20belong%20to%20the%20morning%20shift%20most%20hours%20and%20Employee2%20might%20belong%20to%20the%20mid%20shift%20most%20hours%20but%20because%20of%20the%20overlap%20your%20dataset%20only%20indicates%20which%20employees%20are%20in%20overlapping%20shifts%20but%20not%20actually%20indicate%20which%20actual%20shift%20the%20belong%20to.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2715784%22%20slang%3D%22en-US%22%3ERe%3A%20Filtering%20Away%20Certain%20Duplicate%20Values%20in%20Pivot%20Data%20Source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2715784%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1047584%22%20target%3D%22_blank%22%3E%40Yea_So%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20answering.%20I%20edited%20the%20file%20including%20shifts%20for%20each%20employee%20and%20made%20it%20more%20concise%20and%20readable.%20Including%20only%201%20set%20of%20data%20for%201%20day.%20Also%20someone%20else%20suggested%20me%20using%20a%20helper%20to%20identify%20overlap%20hours%20and%20exclude%20them%20using%20slicer%20but%20It's%20not%20working%20as%20intended.%20It's%20not%20my%20formula.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2721210%22%20slang%3D%22en-US%22%3ERe%3A%20Filtering%20Away%20Certain%20Duplicate%20Values%20in%20Pivot%20Data%20Source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2721210%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1142876%22%20target%3D%22_blank%22%3E%40kheldar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eon%20the%20screen%20shot%20below%20how%20can%20anyone%20tell%20which%20ones%20the%20duplicates%20are%20for%20that%20employee%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Yea_So_0-1630825738640.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F308167iDC3147A0A37E7BA1%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Yea_So_0-1630825738640.png%22%20alt%3D%22Yea_So_0-1630825738640.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2721786%22%20slang%3D%22en-US%22%3ERe%3A%20Filtering%20Away%20Certain%20Duplicate%20Values%20in%20Pivot%20Data%20Source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2721786%22%20slang%3D%22en-US%22%3EThis%20is%20very%20it%20gets%20complicated%20I%20believe.%20Employee%201%20is%20on%20mid%20shift.%20so%20morning%20and%20night%20are%20duplicates.%20So%20If%20Moderation%20task%20of%20queue%201%20is%20less%20than%20lets%20say%20%2530%20of%20other%20queue%201s%20they%20are%20duplicate.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2721812%22%20slang%3D%22en-US%22%3ERe%3A%20Filtering%20Away%20Certain%20Duplicate%20Values%20in%20Pivot%20Data%20Source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2721812%22%20slang%3D%22en-US%22%3EIf%20I%20were%20to%20make%20a%20wild%20guess%20on%20the%20screenshot%20image%3CBR%20%2F%3EI%20would%20pick%20row%202%20and%20row%20160%20to%20be%20the%20actual%20shifts%2C%20the%20rest%20are%20overlaps.%3CBR%20%2F%3EWhat%20are%20your%20thoughts%20on%20my%20guess%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2721833%22%20slang%3D%22en-US%22%3ERe%3A%20Filtering%20Away%20Certain%20Duplicate%20Values%20in%20Pivot%20Data%20Source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2721833%22%20slang%3D%22en-US%22%3EEmployee%201%20is%20on%20mid%20shift.%20So%20he%20appears%20on%20both%20morning%20and%20night%20shift%20overlaps%20which%20I%20want%20to%20exclude%20him%20from.%20I%20don't%20know%20how%20to%20write%20the%20formula%20but%20the%20logic%20comes%20to%20my%20mind%20is%20that%20take%20the%20max%20of%20these%20values%2C%20including%20only%20max%20ignore%20rest.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2722131%22%20slang%3D%22en-US%22%3ERe%3A%20Filtering%20Away%20Certain%20Duplicate%20Values%20in%20Pivot%20Data%20Source%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2722131%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1142876%22%20target%3D%22_blank%22%3E%40kheldar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EChanged%20the%20Name%201%20to%20Name01%3C%2FP%3E%3CP%3ESorted%20the%20dataset%20by%20Name%20and%26nbsp%3BNo.%20of%20Initial%20Moderation%20Tasks%3C%2FP%3E%3CP%3Ecreated%20filter%20columns%20rank%2C%20count%2C%20subnum%2C%20ref%3C%2FP%3E%3CP%3Edid%20a%20power%20query%20on%20dataset%20including%20filter%20columns%3C%2FP%3E%3CP%3Ecreated%202%20reference%20queries%20Top%202%20and%20Bottoms%20queries%3C%2FP%3E%3CP%3Efiltered%20out%20bottoms%20on%20Top%202%20reference%20query%3C%2FP%3E%3CP%3Efiltered%20out%20Top2%20on%20Bottoms%20reference%20query%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Yea_So_0-1630868613045.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F308211iCAB44C404354AAD2%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Yea_So_0-1630868613045.png%22%20alt%3D%22Yea_So_0-1630868613045.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Yea_So_1-1630868632786.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F308212iEDF45EECE5C2EC72%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Yea_So_1-1630868632786.png%22%20alt%3D%22Yea_So_1-1630868632786.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Echeers%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello,

I'm using Pivot Table and Slicer to filter data from a raw data source. Our employees work rotating shifts. Between those shifts there are overlap hours. I created a file to track their performance during those 9 hours of shifts.

 

Morning shift: 08:00 - 17:00

Mid Shift : 16:00 - 01:00

Night Shift : 23:30 - 08:30

 

I'm using Slicer to select between shifts.

 

Our tool provides the raw data I need without separating shifts. So for overlap hours (16:00 - 17:00) we get duplicate data resulting in employees appearing in both morning and mid shift in the Pivot Table. What I want is to Excel to ignore the second data set for duplicate entries and not include them in the pivot. Is this possible? Or is there any other way?

 

Am I clear enough? If not I can provide more info.

 

I'm attaching the excel file I'm working on for you to see what I'm doing.


17 Replies

@kheldar 

 

Not with your dataset since it cannot actually tell which employee belongs to which actual shift, i.e Employee1 might belong to the morning shift most hours and Employee2 might belong to the mid shift most hours but because of the overlap your dataset only indicates which employees are in overlapping shifts but not actually indicate which actual shift the belong to.

@Yea_So 

 

Thank you for answering. I edited the file including shifts for each employee and made it more concise and readable. Including only 1 set of data for 1 day. Also someone else suggested me using a helper to identify overlap hours and exclude them using slicer but It's not working as intended. It's not my formula.

@kheldar 

 

on the screen shot below how can anyone tell which ones the duplicates are for that employee:

Yea_So_0-1630825738640.png

 

This is very it gets complicated I believe. Employee 1 is on mid shift. so morning and night are duplicates. So If Moderation task of queue 1 is less than lets say %30 of other queue 1s they are duplicate.
If I were to make a wild guess on the screenshot image
I would pick row 2 and row 160 to be the actual shifts, the rest are overlaps.
What are your thoughts on my guess?
Employee 1 is on mid shift. So he appears on both morning and night shift overlaps which I want to exclude him from. I don't know how to write the formula but the logic comes to my mind is that take the max of these values, including only max ignore rest.
best response confirmed by allyreckerman (Microsoft)
Solution

@kheldar 

 

Changed the Name 1 to Name01

Sorted the dataset by Name and No. of Initial Moderation Tasks

created filter columns rank, count, subnum, ref

did a power query on dataset including filter columns

created 2 reference queries Top 2 and Bottoms queries

filtered out bottoms on Top 2 reference query

filtered out Top2 on Bottoms reference query

Yea_So_0-1630868613045.png

Yea_So_1-1630868632786.png

 

cheers

Man that looks awesome. Could you share the file as well?

see the bottom of my previous post

Your next issue would be how to distribute the bottoms to the top 2 and which the bottoms belong to

 

what formula did you use for column Avg. Handling Time(s)

Many thanks man, I'm trying to figure out your logic. I shouldn't ask more of you. There is no formula for AHT. Raw data source provides that.
you better check your dataset since I found straggler formulas in that column by selecting the column and do a find all "="

@kheldar 

the logic is:
rank column = summed up employee01's No. of Initial Moderation Tasks then got the ratio of each Initial Moderation Tasks to get the % so it can be ranked

=Table1[@[No. of Initial Moderation Tasks]]/SUMIF(Table1[Name],AB2,Table1[No. of Initial Moderation Tasks])

count = get the count of instances of each employee so each row can be assigned a subnumber so then the top 2 can be separated from the bottom Ns

some employees have 1, some have 2, some have 3, some have 4, some have 5 and some have 6 instances

So in order to get the top 2 I filtered out the subnumber 3,4,5, and 6

and vice versa for the bottoms 

 

The Top 2 are the actual shifts

The Bottoms are the overlaps

 

To figure out the distribution of the overlaps,

add all the No. of Initial Moderation Tasks in the Bottoms Sheet which will be the 100%

 

Add the Avg. Handling Time(s) in the Bottoms sheet then divide it by 60 seconds 

Amendment: 

Add the Avg. Handling Time(s) in the Bottoms sheet then divide it by 60 minutes

 

then divide the sum of No. of Initial Moderation Tasks in the Bottoms Sheet
by the quotient Avg. Handling Time(s) in the Bottoms sheet 

So now you have the No. of Initial Moderation Tasks in the Bottoms Sheet per minute

Multiply it by the overlap Hours/Minutes to get the distribution for each shift

 

then calculate ratio the shift hours:

Morning shift: 08:00 - 17:00

Mid Shift : 16:00 - 01:00

Night Shift : 23:30 - 08:30

 

Morning to Mid Shift is 1 hour

Mid Shift to Night Shift is 30 minutes

Night Shift to Morning Shift is 30 minutes

Thank you man! I'm not at the level of fully comprehending your explanation yet, however, I'll consult a friend. I'll hit you up again, if we can't figure it, of course if that's okay for you.
Yes do consult your friend to get a second opinion

cheers

@kheldar 

 

The bottoms calculation for the distribution is just an average ballpark since that is what your current dataset allows (an educated guess), unless you have a more granular dataset which specifically gives you the actual No. of Initial Moderation Tasks in the Bottoms Sheet stats for each shift.

Don't get me wrong. It's not about getting a second opinion. It's about understanding the way you constructed this

@kheldar 

 

I'm glad that helped you