cmcreynolds
Active Member
- Joined
- May 21, 2015
- Messages
- 295
Hello, I hope everyone is well. Long time, no post
I receive non-normalized data from our field staff who are in teams of 2. For our final analysis, we choose only the team lead (indicated in its own field/column as TL). However, on rare occasion, they leave their response blank and we need to consider the other team member's response.
The issue is there are 82 fields to consider (not my structure, btw). I could come up with an approach if there were only a handful of fields, but writing 82 IF statements would drive me quite bonkers.
I use Get and Transform to extract the data from various folders and I was hoping the solution could be used there. But I could only find a way to replace variables one column at a time.
Here's a short version of how the data is set up.
[TABLE="width: 500"]
<tbody>[TR]
[TD]SiteCode
[/TD]
[TD]TeamLead
[/TD]
[TD]Q1
[/TD]
[TD]Q2
[/TD]
[TD]Q3
[/TD]
[TD]Q4
[/TD]
[/TR]
[TR]
[TD]033
[/TD]
[TD]TL
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]033
[/TD]
[TD]NL
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]151
[/TD]
[TD]TL
[/TD]
[TD]99
[/TD]
[TD]2
[/TD]
[TD]4
[/TD]
[TD]4
[/TD]
[/TR]
[TR]
[TD]151
[/TD]
[TD]NL
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]222
[/TD]
[TD]TL
[/TD]
[TD]4
[/TD]
[TD]99
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]222
[/TD]
[TD]NL
[/TD]
[TD]2
[/TD]
[TD]4
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]167
[/TD]
[TD]TL
[/TD]
[TD]99
[/TD]
[TD]0
[/TD]
[TD]99
[/TD]
[TD]99
[/TD]
[/TR]
[TR]
[TD]167
[/TD]
[TD]NL
[/TD]
[TD]1
[/TD]
[TD]3
[/TD]
[TD]2
[/TD]
[TD]2
[/TD]
[/TR]
</tbody>[/TABLE]
Basically, whenever a TL has a '99' we look at the NL's response. Example: For Q1, site 151, we would want a '1' in the final data set
Again, I have 82 fields to apply this to.
(I looked at 'Group By' and it seemed daunting, I was hoping there was functionality I was overlooking - either in PowerQuery or PowerPivot)
Thank you!
Clifton
I receive non-normalized data from our field staff who are in teams of 2. For our final analysis, we choose only the team lead (indicated in its own field/column as TL). However, on rare occasion, they leave their response blank and we need to consider the other team member's response.
The issue is there are 82 fields to consider (not my structure, btw). I could come up with an approach if there were only a handful of fields, but writing 82 IF statements would drive me quite bonkers.
I use Get and Transform to extract the data from various folders and I was hoping the solution could be used there. But I could only find a way to replace variables one column at a time.
Here's a short version of how the data is set up.
[TABLE="width: 500"]
<tbody>[TR]
[TD]SiteCode
[/TD]
[TD]TeamLead
[/TD]
[TD]Q1
[/TD]
[TD]Q2
[/TD]
[TD]Q3
[/TD]
[TD]Q4
[/TD]
[/TR]
[TR]
[TD]033
[/TD]
[TD]TL
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]033
[/TD]
[TD]NL
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]151
[/TD]
[TD]TL
[/TD]
[TD]99
[/TD]
[TD]2
[/TD]
[TD]4
[/TD]
[TD]4
[/TD]
[/TR]
[TR]
[TD]151
[/TD]
[TD]NL
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]222
[/TD]
[TD]TL
[/TD]
[TD]4
[/TD]
[TD]99
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]222
[/TD]
[TD]NL
[/TD]
[TD]2
[/TD]
[TD]4
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]167
[/TD]
[TD]TL
[/TD]
[TD]99
[/TD]
[TD]0
[/TD]
[TD]99
[/TD]
[TD]99
[/TD]
[/TR]
[TR]
[TD]167
[/TD]
[TD]NL
[/TD]
[TD]1
[/TD]
[TD]3
[/TD]
[TD]2
[/TD]
[TD]2
[/TD]
[/TR]
</tbody>[/TABLE]
Basically, whenever a TL has a '99' we look at the NL's response. Example: For Q1, site 151, we would want a '1' in the final data set
Again, I have 82 fields to apply this to.
(I looked at 'Group By' and it seemed daunting, I was hoping there was functionality I was overlooking - either in PowerQuery or PowerPivot)
Thank you!
Clifton