cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Comparing excel table with some conditions

Hi, I'm a beginner in Power Automate and got stuck on building Flow.

I want to compare two tables to get status of "Is it the same value or not". Both tables consist of information such as code number, parameter, min, target, and max. One code number can consist of more than one parameter. If there is a code number with several parameters, the excel data lists the same value on the code number but the different values on the parameter.

 

I want to compare the value of min, max, and target of the same code number, and parameter. I want to add a column "status" to show, is it aligned or not, as an output.

Then, if the value of min, max, and target from table 2 is different from table 1, I want to make a new table as a summary consists of code number and parameter. Since the parameter may consist of more than one value, I want the summary table only consists of one cell for one code number, so the parameter lists on the same cell and separates by ",(comma)".

I've tried to make the flows, but when I tested it, the result was not the same as I wanted to and each status of comparison was same even there was a different value.

 

Can anybody give me a good advice.

Thanks a lot for your time and help in advance.

 

Best Regards

 

 

 

8 REPLIES 8
Community Support
Community Support

Hi @helmiupsp,

 

You could initialize an integer variable to set its default min value is the first row of Excel table.

 

Then create an Apply to each action to loop rows, if the current row value is less than the variable value, set the variable value to the current row value.

outputs('List_rows_present_in_a_table')?['body/value'][0]['Min']

Screenshot 2020-10-12 140943.jpg

 

Screenshot 2020-10-12 140957.jpg

 

It seems like you need three values, min, max, and target. So you could initialize three variables to do that.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-litu-msft  Thanks for the help, but I used a different method and got solved. But, I faced a new problem. I want to make the summary table for the ID which had unmatched value for the min, max, and target. I used the "add row" feature. Since I used the scheduled flow, the result for the next run will be listed below the result from the previous run. I want the summary data to only consist of the result from the newest run. I tried to use the "update row" feature, but I don't know how to fill the key column and key-value because I think I don't have the unique identifier. The summary table consists of parameters and code numbers in new file/table. Can you help me about that? 

Thank you

Regards.

Hi @helmiupsp,

 

It's recommended to create a unique identifier for each row for update row could be run.

 

Also, you could use List rows present in a table action + Filter query to find rows that have same parameters and code numbers, and then use Apply to each action + Update a row to update them.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Responsive Resident
Responsive Resident

@helmiupsp ,

 

If you only want the table to have the data from the most recent run, you should clear out the table by deleting all the rows in it before the rest of your flow runs.

 

 

 

In the example below, you can see that as you loop through the rows in the table, the row will be deleted if the key value (in this case, the value in the "Title" column) matches the value in the "Title" column. Obviously this will always evaluate as true and thus every line in your table will be deleted.2020-10-20_9-19-53.png

 

Then you will have an empty table to populate with your current run's data.

 

Make sure you do this near the beginning of your Flow. Or at least somewhere before the point that you are adding data to your table.

 

Please let me know if you have any questions.

 

thanks,

Kyle

Hi @kdavis91 

I've tried your recommendation and it worked well.

Then, I want to attach the file of the summary data into an email notification. I used the "get file metadata" and "get file content", then "send email notification(V3)". On the summary table, it showed the newest result of the flow run, but on the attached file, only show the first row of the result, can you suggest me a solution about that? 

 

Thanks,

Regards.

 

Helmi

Responsive Resident
Responsive Resident

@helmiupsp ,

 

Glad you got your table working!

 

As for attaching a file to your email notification, that isn't something I have any direct experience with, but it looks like this thread deals with it pretty extensively:

 

https://powerusers.microsoft.com/t5/Building-Flows/Email-Attachments-in-Flow/td-p/194363 

 

Most issues that can occur have probably already been addressed on a thread in this forum. I suggest searching the forum for any new obstacle that you encounter in building your flows before asking. No sense in reinventing the wheel!

 

I hope this helps!

thanks,

Kyle

Hi @v-litu-msft 

Thanks for the recommendation. I've solved that problem.

I faced a new problem, so I want to attach the summary table file to an email notification. I used "get file metadata" and "get file content" feature and "send an email notification (V3)". It was successful but, the email labeled as external. I want to make it as high priority email. Then, for the problem that I told before about I just want to include the newest result for the run, I used the "delete row" in the early step, then the "add a row" flow can run after that. But, in the email attachment file, it results inconsistent, sometimes it can show the full data from the summary table, sometimes it can't.

 

Do you have any suggestions for that? Thank you

 

Regard

Helmi

Hi @helmiupsp,

 

About remove label External, you could refer to this post:

How to remove external warning - Microsoft Community

You could set the Importance property of the Email to make it as high priority email:

Screenshot 2020-11-02 160915.jpg

 

After you add a row into Excel file, before send email, you could add a delay action that 1 minute to make Excel file could has enough time to update, please have a try.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (7,540)