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

This worked. Thank you!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,678)