Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi all. I need to remove specific rows that have "code ABC" with date before 8/15/2019 and rows that have "code XYZ" with date before 7/29/2019. These are in two different columns. I cannot simply filter the table afterwards because the table is connected to many other excel files that use its data. I think there needs to be a custom step written, but I'm not sure how to do that.
Solved! Go to Solution.
Add a custom column that shows the records that you want to exclude. Perhaps you call the column "Exclude"
[code] = "ABC" and [date] < #date(2019, 8, 15) or [code] = "XYZ" and [date] < #date(2019, 7, 29). Now filter with Exclude = false.
Below is some sample code.
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"code", type text}, {"date", type datetime}}),
#"Extracted Date" = Table.TransformColumns(#"Changed Type",{{"date", DateTime.Date, type date}}),
AddExclude = Table.AddColumn(#"Extracted Date", "Exclude", each [code] = "ABC" and [date] < #date(2019, 8, 15) or [code] = "XYZ" and [date] < #date(2019, 7, 29)),
#"Filtered Rows" = Table.SelectRows(AddExclude, each ([Exclude] = false))
in
#"Filtered Rows"
Add a custom column that shows the records that you want to exclude. Perhaps you call the column "Exclude"
[code] = "ABC" and [date] < #date(2019, 8, 15) or [code] = "XYZ" and [date] < #date(2019, 7, 29). Now filter with Exclude = false.
Below is some sample code.
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"code", type text}, {"date", type datetime}}),
#"Extracted Date" = Table.TransformColumns(#"Changed Type",{{"date", DateTime.Date, type date}}),
AddExclude = Table.AddColumn(#"Extracted Date", "Exclude", each [code] = "ABC" and [date] < #date(2019, 8, 15) or [code] = "XYZ" and [date] < #date(2019, 7, 29)),
#"Filtered Rows" = Table.SelectRows(AddExclude, each ([Exclude] = false))
in
#"Filtered Rows"
Hi @Anonymous , this might be a good one for @ImkeF who is the master of m!
Nathaniel
Proud to be a Super User!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |