Help, sum and average by code in roster

Discussions about CSEntry
Post Reply
PHINOJOSA
Posts: 45
Joined: April 16th, 2023, 10:31 pm

Help, sum and average by code in roster

Post 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 39392 times
Sum.zip
(67.33 KiB) Downloaded 362 times
justinlakier
Posts: 152
Joined: November 21st, 2022, 4:41 pm

Re: Help, sum and average by code in roster

Post 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
Attachments
Sum.zip
(67.5 KiB) Downloaded 345 times
PHINOJOSA
Posts: 45
Joined: April 16th, 2023, 10:31 pm

Re: Help, sum and average by code in roster

Post 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 39374 times
justinlakier
Posts: 152
Joined: November 21st, 2022, 4:41 pm

Re: Help, sum and average by code in roster

Post 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
Attachments
Sum.zip
(67.59 KiB) Downloaded 357 times
PHINOJOSA
Posts: 45
Joined: April 16th, 2023, 10:31 pm

Re: Help, sum and average by code in roster

Post 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
Post Reply