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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Andy_T
Frequent Visitor

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
Super User
Super User

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.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

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.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.