Forum Discussion
Help Creating Customized Filter
- 2 years ago
Hello zhoura345,
If my post helped you, please give me a 👍kudos and mark this post with Accept as Solution.Okay, sorry, it's already late in Germany. Here is the right solution.
let //Replace the first Step with your DataTable //Source = DataTable Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdCxCsIwEMbxVymZC7273Ine1gcoCI6lg6BDF4dSfH4jSZpLQNwy/Mg/+ebZoevduG3r+xkOp4EHAuJOVEABuuvklj6i27r/E/v99bDmXBuyKQkkK8KvGouKrUIuKtKSFAso1ZAUbc43uVxj36Cj9lscsdzCGnG9Ikbl1YN5NpsVk8AkzDVlRcyfL2b5AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Trip Number" = _t, #"Activity Name" = _t, #"Activity Date and Time" = _t]), GroupedData = Table.Group(Source, {"Trip Number", "Activity Date and Time"}, {{"Count", each Table.RowCount(_), Int64.Type}}), Filtered = Table.SelectRows(GroupedData, each [Count] > 1), Duplicated = Table.SelectColumns(Filtered, {"Trip Number"}), Unique = Table.Distinct(Duplicated), Merged = Table.NestedJoin(Source, {"Trip Number"}, Unique, {"Trip Number"}, "Duplicates", JoinKind.LeftOuter), FilteredData = Table.SelectRows(Merged, each Table.IsEmpty([Duplicates])), CleanedData = Table.RemoveColumns(FilteredData, {"Duplicates"}) in CleanedData
Best regards from Germany
Manuel Bolz
🟦Follow me on LinkedIn
🟨How to Get Your Question Answered Quickly
🟩Fabric Community Conference
🟪My Solutions on Github
Hello zhoura345,
if my post helped you, please give me a 👍kudos and mark this post with Accept as Solution.
Try this solution:
let
//Replace the first Step with your DataTable
//Source = DataTable
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdCxCsIwEMbxVymZC7273Ine1gcoCI6lg6BDF4dSfH4jSZpLQNwy/Mg/+ebZoevduG3r+xkOp4EHAuJOVEABuuvklj6i27r/E/v99bDmXBuyKQkkK8KvGouKrUIuKtKSFAso1ZAUbc43uVxj36Cj9lscsdzCGnG9Ikbl1YN5NpsVk8AkzDVlRcyfL2b5AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Trip Number" = _t, #"Activity Name" = _t, #"Activity Date and Time" = _t]),
Grouped = Table.Group(Source, {"Trip Number", "Activity Date and Time"}, {{"Count", each Table.RowCount(_), Int64.Type}}),
Filtered = Table.SelectRows(Grouped, each [Count] > 1),
Duplicates = Table.SelectColumns(Filtered, {"Trip Number", "Activity Date and Time"}),
Merged = Table.NestedJoin(Source, {"Trip Number", "Activity Date and Time"}, Duplicates, {"Trip Number", "Activity Date and Time"}, "Duplicates", JoinKind.LeftOuter),
Removed = Table.SelectRows(Merged, each Table.IsEmpty([Duplicates])),
Cleaned = Table.RemoveColumns(Removed, {"Duplicates"})
in
Cleaned
Best regards from Germany
Manuel Bolz
🟦Follow me on LinkedIn
🟨How to Get Your Question Answered Quickly
🟩Fabric Community Conference
🟪My Solutions on Github
Ty! Would it be possible to do without coding directly in Advanced Editor or if you could share your PBIX file?
Also, when I copied your code, I got this, which was not the same end result as the image I had above:
- ManuelBolz2 years agoResponsive Resident
Hello zhoura345,
you just have to replace the "source-step" in my code. The information is in the first 4 lines of my example.
If my post helped you, please give me a 👍kudos and mark this post with Accept as Solution.
Best regards from Germany
Manuel Bolz
🟦Follow me on LinkedIn
🟨How to Get Your Question Answered Quickly
🟩Fabric Community Conference
🟪My Solutions on Github- zhoura3452 years agoFrequent Visitor
Your result kept Trip Number 1 and 3, but I am looking to have those be gone, only keep 2 and 4 from this sample dataset.
- ManuelBolz2 years agoResponsive Resident
Hello zhoura345,
If my post helped you, please give me a 👍kudos and mark this post with Accept as Solution.Okay, sorry, it's already late in Germany. Here is the right solution.
let //Replace the first Step with your DataTable //Source = DataTable Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdCxCsIwEMbxVymZC7273Ine1gcoCI6lg6BDF4dSfH4jSZpLQNwy/Mg/+ebZoevduG3r+xkOp4EHAuJOVEABuuvklj6i27r/E/v99bDmXBuyKQkkK8KvGouKrUIuKtKSFAso1ZAUbc43uVxj36Cj9lscsdzCGnG9Ikbl1YN5NpsVk8AkzDVlRcyfL2b5AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Trip Number" = _t, #"Activity Name" = _t, #"Activity Date and Time" = _t]), GroupedData = Table.Group(Source, {"Trip Number", "Activity Date and Time"}, {{"Count", each Table.RowCount(_), Int64.Type}}), Filtered = Table.SelectRows(GroupedData, each [Count] > 1), Duplicated = Table.SelectColumns(Filtered, {"Trip Number"}), Unique = Table.Distinct(Duplicated), Merged = Table.NestedJoin(Source, {"Trip Number"}, Unique, {"Trip Number"}, "Duplicates", JoinKind.LeftOuter), FilteredData = Table.SelectRows(Merged, each Table.IsEmpty([Duplicates])), CleanedData = Table.RemoveColumns(FilteredData, {"Duplicates"}) in CleanedData
Best regards from Germany
Manuel Bolz
🟦Follow me on LinkedIn
🟨How to Get Your Question Answered Quickly
🟩Fabric Community Conference
🟪My Solutions on Github