Page 1 of 1

Help, sum and average by code in roster

Posted: December 29th, 2023, 8:39 am
by PHINOJOSA
Hello

Once again I turn to you, on this occasion I have not been able to do calculations in a roster by code, I developed an application for a company that has several sellers and in the roster the sale is entered for each seller on a monthly basis as the case may be and I wish that On the roster is the total sum for each salesperson and the annual average for each salesperson, but it is something that I have not achieved yet. So I turn to you.

I attach the project and the image of how it currently is and what it should be. The image is also in the compressed file.

Thanks for your support
Captura01.PNG
Captura01.PNG (81.51 KiB) Viewed 40315 times
Sum.zip
(67.33 KiB) Downloaded 507 times

Re: Help, sum and average by code in roster

Posted: December 29th, 2023, 3:24 pm
by justinlakier
Hello,

This does not work because when you find the sum or average of a column, you are finding the sum or average of that entire column. If you want the columns to be divided by Seller, you need to implement some code in the loops which checks this, and only adds to the sum or average if they match the Seller. I used WHERE to filter by seller, and numeric variables to hold the sum or average for each seller over the loop. I have attached the edited program below, and the results look like the graphic you provided. Let us know if you have any additional questions.

Hope this helps,
Justin

Re: Help, sum and average by code in roster

Posted: December 29th, 2023, 4:07 pm
by PHINOJOSA
Hi Justinlakier.

Thank you very much for your help and your time, regarding the seller's accumulated sum it is not yet updated, the modification to the total per seller and the average per seller is correct, but the accumulated sum per seller would be missing.

It is highlighted in the image with yellow.

Thank you so much
Captura02.PNG
Captura02.PNG (85.39 KiB) Viewed 40297 times

Re: Help, sum and average by code in roster

Posted: January 1st, 2024, 6:10 pm
by justinlakier
Hello,

Regarding finding the accumulated amount, this has almost the same solution as calculating Annual Sales Amount for a specific person. However instead of using a second loop to make each sales month for the person have the same sum, you only use the first loop to find the sum at that point.

Hope this helps,
Justin

Re: Help, sum and average by code in roster

Posted: January 3rd, 2024, 8:55 am
by PHINOJOSA
Hi Justinlakier.

First of all, I hope you have had an excellent New Year in the company of your loved ones.

Thank you for your help and your time, with this last modification the application runs correctly.

I am learning about programming with every help I receive, I learn new things that I apply in other projects.

Thanks for everything

Sincerely PH