cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bchager6
Helper I
Helper I

Count rows in a CSV table

Hello,

 

I created a Flow within a Power BI report that populates a .csv table based on projects selected in the Power BI report, then it sends the .csv in an email.

 

I would like to count the number of rows in the .csv table and create a condition to send only if the number of rows selected are less than 5. 

 

Can anyone guide me on how to arrive at the row count in the .csv table that's created? From there, I can apply a condition.

 

 

bchager6_0-1638819648324.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @bchager6 

 

I can see you already using an array for creating the CSV file. You could try the length() expression, pass the parameter as the array.

 

If that doesn't work follow the below steps.

 

image.png

 

Above under the EnterKey variable press the keyboard enterkey as the default value.

 

Above expression I used is as follows:

 

length(split(body('Create_CSV_table'),variables('EnterKey')))
 
This length will give you the contents with header. If you want to get the contents row count only then use the sub() expression to subtract 1 from the total lines.
 
Thanks
 
 


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

2 REPLIES 2
abm
Super User
Super User

Hi @bchager6 

 

I can see you already using an array for creating the CSV file. You could try the length() expression, pass the parameter as the array.

 

If that doesn't work follow the below steps.

 

image.png

 

Above under the EnterKey variable press the keyboard enterkey as the default value.

 

Above expression I used is as follows:

 

length(split(body('Create_CSV_table'),variables('EnterKey')))
 
This length will give you the contents with header. If you want to get the contents row count only then use the sub() expression to subtract 1 from the total lines.
 
Thanks
 
 


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

This worked. Thank you!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,340)