Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
How do I write a query to remove all of the rows of a "group" based on some column data. For example in the below I want to remove all Owner rows where the driver doesn't own a Toyota.
Owner Car
The result I am after would remove all Smith rows because they have never owned a Toyota
|
Hello, @Mikee5 Group by owner, check if [Car] column contains "Toyota" and then select TRUE only. Just an idea.
let
Source = your_table,
group = Table.Group(Source, "Owner", {{"rows", each _}, {"Toyota_owner", each List.Contains(_[Car], "Toyota")}}),
filter = Table.SelectRows(group, each ([Toyota_owner] = true)),
result = Table.Combine(filter[rows])
in
result
another option is to filter table to get a list of Toyota owners only and then filter table again by Owners column
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
names = List.Buffer(List.Distinct(Table.SelectRows(Source, each [Car] = "Toyota")[Owner])),
result = Table.SelectRows(Source, each List.Contains(names, [Owner]))
in
result
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
12 | |
9 | |
8 |