Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
PamWren
Frequent Visitor

Power Query Help required!

I have a dataset where the output shows employees and whether a reocord is locked or not.  Sme employees have both locked and not locked, ultimately showing 2 different rows for each.  I need to exclude any employee who has a no (even if they also have a yes).  I have included a screen shot, those highlighted in Yellow need to be excluded.  I can't remove duplicates as it doesnt remove in any order, i cant remove Yes for obvious reasons and removing no still leaves those yes's behind which need to be excluded.

 

PamWren_0-1723804536884.png

An help would be gratefully received.

 

Thanks

1 ACCEPTED SOLUTION
dufoq3
Community Champion
Community Champion

Hi @PamWren, check this:

 

Before

dufoq3_0-1723807669111.png

 

After

dufoq3_1-1723807690266.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY85DoAwDAT/4jqFE5/5BD2KUlJT8H8JCkgMottdzVhya2AZhRgSrNsBPTVgRje/hmV/9wfwrKwWhoyoUv6G+0SpVbkGwAQJPwa5TWP0AYQcRZpOiPEf+cv9BA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"EE ID" = _t, Locked = _t]),
    GroupedRows = Table.Group(Source, {"EE ID"}, {{"All", each _, type table}, {"FilterHelper", each if List.ContainsAll([Locked], {"Yes", "No"}) then 0 else 1, Int64.Type}}),
    FilteredRows = Table.SelectRows(GroupedRows, each ([FilterHelper] = 1)),
    Combined = Table.Combine(FilteredRows[All])
in
    Combined

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

2 REPLIES 2
dufoq3
Community Champion
Community Champion

Hi @PamWren, check this:

 

Before

dufoq3_0-1723807669111.png

 

After

dufoq3_1-1723807690266.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY85DoAwDAT/4jqFE5/5BD2KUlJT8H8JCkgMottdzVhya2AZhRgSrNsBPTVgRje/hmV/9wfwrKwWhoyoUv6G+0SpVbkGwAQJPwa5TWP0AYQcRZpOiPEf+cv9BA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"EE ID" = _t, Locked = _t]),
    GroupedRows = Table.Group(Source, {"EE ID"}, {{"All", each _, type table}, {"FilterHelper", each if List.ContainsAll([Locked], {"Yes", "No"}) then 0 else 1, Int64.Type}}),
    FilteredRows = Table.SelectRows(GroupedRows, each ([FilterHelper] = 1)),
    Combined = Table.Combine(FilteredRows[All])
in
    Combined

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Thanks for your help - I actually found a fix myself over the weekend which worked beautifully.  But again thankyou. 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.