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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
HeimoW
Regular Visitor

Remove lines depending on a condition while grouping

I want to group an imported SQL-table in the PowerQueryEditor but exclude all rows which have are not "null" in a certain column.

 

CODE:

let
    Source = Sql.Database("SQL-xxx", "xxxx"),
    dbo_personnel = Source{[Schema="dbo",Item="personnel"]}[Data],
    #"Grouped Rows" = Table.Group(dbo_personnel, {"Co_id"}, {{"Count", each Table.RowCount(_), type number}})
in
    #"Grouped Rows"

 

 

Appreciate any help! Thanks

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

How about filtering out the null column before you do the groupby?



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

3 REPLIES 3
MattAllington
Community Champion
Community Champion

How about filtering out the null column before you do the groupby?



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Thanks but,

 

I did not find an option for filtering in the PowerQueryEditor (my workaround was to create a view on the SQL-server). And filtering in the PowerPI Desktop is not an option as the grouping does not allow me to get distinct values in the relevant column.

(I want to count all personnel which do not have an exit-date) - all active personnel.

Found it

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors