Forum Discussion
Column analysis
- Anonymous6 years ago
Do you mean something like this?
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZdA7DsNACATQu2ztAhgWs2XKFJHcW77/NfyRZaNJ+8QMiHVtmSFDU9vUPm2bbnA74fsClEBnjigBBndwRIMjVgAekQV+S8bsw+Sf6rXh3UAxog4FIIJ4YteURh/lAN5WdlEP6npucbWgm4kOkOPjNFNo2wE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Clave de Plaza" = _t, #"ACT / INAC" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Clave de Plaza", type text}, {"ACT / INAC", type text}}), #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Clave de Plaza", "Temp"), #"Replaced Value" = Table.ReplaceValue(#"Duplicated Column","MP","",Replacer.ReplaceText,{"Temp"}), #"Grouped Rows" = Table.Group(#"Replaced Value", {"Temp"}, {{"Count", each Table.RowCount(_), type number}, {"Pass", each List.ContainsAll(_[#"ACT / INAC"], {"I"}), type logical}}), #"Filtered Rows1" = Table.SelectRows(#"Grouped Rows", each ([Count] = 2)), #"Merged Queries" = Table.NestedJoin(#"Replaced Value", {"Temp"}, #"Filtered Rows1", {"Temp"}, "Filtered Rows1", JoinKind.LeftOuter), #"Expanded Filtered Rows1" = Table.ExpandTableColumn(#"Merged Queries", "Filtered Rows1", {"Pass"}, {"Pass"}), #"Removed Columns" = Table.RemoveColumns(#"Expanded Filtered Rows1",{"Temp"}) in #"Removed Columns"Kind regards,
JB
Hi Anonymous
there are some considerations that may impact on the solution:
1. Is this guaranteed that there is a pair ID & MP+ID? Or ID can be without MP+ID and vice versa?
2. Is this guaranteed that there is only one unique ID and one unique MP+ID in the entire table?
3. If #1 is not guaranteed how do you want to treat single ID or MP+ID - error? or ignore?
4. If there is more than one unique ID or MP+ID how this is treated? All need to be of opposed type? Eg. three IDs (A/A/A) and MP+ID (I/I/I)? or if at least one opposed pair we are Ok (e.g. ID(A/A/A) and MP+ID (A/I/A)?
Thanks,
JB
there can be ID witouth MP+ID but those ID's are ignored, what i only need to analize is the pairs ID & MP+ID, thanks