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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Count rows in query editor before applying filters

Hi all,

 

I have an Excel data source which I'm cleaning up using the query editor. I'd like to be able to report in Power BI how many rows there were before any filters were applied in the query editor (in order to tell the project manager how many rows of bad data there are..)

 

The only potential solution I've found is;

 

  • Use 'Extract Previous' to split my query into two at the point of filtering
  • Reference the query containing the pre-filter actions
  • Add the Count Rows action to my reference query

Is there a more elegant solution that anybody is aware of?

 

Thanks.

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

I'm not sure what you would envision as elegant. You could create a custom column in the query editor that would utilize Table.RowCount function and put that step before any filters. You could also create a separate query and all it does is do this, if you want it in a separate table. Again, not sure what qualifies as elegant.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

I'm not sure what you would envision as elegant. You could create a custom column in the query editor that would utilize Table.RowCount function and put that step before any filters. You could also create a separate query and all it does is do this, if you want it in a separate table. Again, not sure what qualifies as elegant.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi, thanks for the reply, I'll take a look at doing a custom column. I was hoping that there would be something I could do with one query, rather than creating multiple queries to get to the result I'm looking for.

Most elegant would be to invite and tell the Project Manager at the bar over a nice glass of his favourite drink. Smiley Wink Smiley LOL

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.