Forum Discussion
RaymondWood
4 years agoFrequent Visitor
Power Bi Remove Rows Based on Category found in a related table.
Hi all. I do a daily download of a CSV file with new tenders from a government site. I am only interested in particular categories of tenders so want to remove any rows with categories that I am not...
- 4 years ago
No problem.
- Open PowerQuery
- From the top menu select New Source > Blank Query
- From the top menu select Advanced Editor and paste the Category Table code in.
- Rename the query to Category Table
- Repeat for the second table using the Tenders Table table, rename table as Tenders Table.
This will show you the steps that I have taken to solve your issue, if you have an specific questions let me know. Happy to point you in the right direction.
James
jsaunders_zero9
4 years agoResponsive Resident
Hi RaymondWood
You can filter the tenders table based on the values in the categories table, by turning the column into a list.
Try the following in Power Query.
Category Table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclSK1YlWcgKTrkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Category = _t])
in
Source
Tenders Table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJUitWJVjKCs4yBLCcwywTIcgazTOEsMyDLVSk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Tender = _t, Category = _t]),
FilterCategories = Table.SelectRows(Source, each (List.Contains(Table.Column(Categories,"Category"),[Category])=true ))
in
FilterCategories
RaymondWood
4 years agoFrequent Visitor
Thank you for you response. I don't know how to use what you have given me.
- jsaunders_zero94 years agoResponsive Resident
No problem.
- Open PowerQuery
- From the top menu select New Source > Blank Query
- From the top menu select Advanced Editor and paste the Category Table code in.
- Rename the query to Category Table
- Repeat for the second table using the Tenders Table table, rename table as Tenders Table.
This will show you the steps that I have taken to solve your issue, if you have an specific questions let me know. Happy to point you in the right direction.
James
- RaymondWood4 years agoFrequent Visitor
Thank you so much James.