Forum Discussion
Conditional column evaluation on grouped data to maintain a distinct list
lbendlin Thanks for your interest in my problem here!
I have thought about using a last modified/logon/etc type of date but of those I thought of, I couldn't think of one that wouldn't introduce a bug that could shift the output of the report based on when it was viewed. In our actual live data there is are two active associates with the same mobile number in AD. This is obviously an error we need to fix, but what could happen to the report if it weren't? If user A is the one with the MAXed value one day but something occurs that shifts the value for User B so that they are the one being pulled from the two then based on when you looked at the report you could see a different name associated. So, I would rather error handle that to alert someone that seeing "Multiple" means that there is data that needs to be corrected. But I think while that logic applies to the active user, what if I have 2 users on a line that are Inactive? I would actually want to use the Last Modified field to display the most recent active user.
I know the logic that I need to apply my problem is that I simply do not know how to do it in this application, and that's what I am looking for help with.
Here's the code for creation of this table currently.
let
Source = VZW_Wireless_Summary,
#"Removed Other Columns" = Table.SelectColumns(Source,{"Wireless Number"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Other Columns"),
#"Sorted Rows" = Table.Sort(#"Removed Duplicates",{{"Wireless Number", Order.Ascending}}),
#"Merged Queries" = Table.NestedJoin(#"Sorted Rows", {"Wireless Number"}, GetBaseUserInfo, {"Formatted Mobile"}, "GetBaseUserInfo", JoinKind.LeftOuter),
#"Expanded GetBaseUserInfo" = Table.ExpandTableColumn(#"Merged Queries", "GetBaseUserInfo", {"displayName", "Custom.extensionAttribute15", "UserStatus.user.userAccountControl"}, {"GetBaseUserInfo.displayName", "GetBaseUserInfo.Custom.extensionAttribute15", "GetBaseUserInfo.UserStatus.user.userAccountControl"}),
#"Replaced Value" = Table.ReplaceValue(#"Expanded GetBaseUserInfo",null,"Missing",Replacer.ReplaceValue,{"GetBaseUserInfo.displayName"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",null,"Missing",Replacer.ReplaceValue,{"GetBaseUserInfo.Custom.extensionAttribute15"}),
#"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1","","Blank",Replacer.ReplaceValue,{"GetBaseUserInfo.Custom.extensionAttribute15"})
in
#"Replaced Value2"The reason I am doing a left outer is because this report is about billing and I only care about those numbers only. AD contains non-company mobile numbers so adding all those records in doesn't seem like it would be beneficial unless I am missing something you could explain further?
What you describe makes sense. Maybe have a matrix as a result with four buckets. Active/Inactive and Single/Multiple for x and y axis. Like a magic quadrant chart 🙂
- ctaylor6 years agoHelper III
I'm confused by your response.
On one hand, that concept could be helpful for the side project to fix up the gaps in AD data that I know exist, but I am not looking for a visual answer. I am looking for code help to be able to parse through the grouped records to create a 1:1 table of data.
Thanks
- lbendlin6 years agoSuper User
I have found through the years that visual solutions are often much easier to achieve than formula based solutions. In other words - I have no idea how your formula could possibly be made to work 🙂 I am sure the experts here will have something that can help you along.