IMPLEMENTATION OF LEAST SQUARE ALGORITHM TO PREDICT MONTHLY REVENUE (CASE STUDY: DJUJU’S GROCERY STORE)

Business owners need to estimate their revenue, which is crucial for the sustainability of their operations. Thus, entrepreneurs such as micro, small, and medium-sized business owners, as well as owners of grocery stores, leverage technological advancements to maximize their sales operations. However, manual sales activities can pose challenges for managing sales data, such as disorganized sales record keeping, failure to record sales of high-volume customers, and time-consuming manual reporting for revenue predictions. To address these issues, researchers have developed a revenue prediction information system. In this study, revenue and profit predictions for the following period were calculated using the Least Square algorithm with the Mean Absolute Percentage Error (MAPE). An example calculation for a 12-month period resulted in a revenue forecast of Rp. 2,837,687.76 for the month of June 2023 with a MAPE of 12.71%.

Based on the above-mentioned problems encountered by Djuju's grocery store, a solution was proposed to build a prediction system for the revenue amount for the next period based on monthly sales data. The purpose of this study is to predict and determine the revenue amount per month for the next period using the Least Square algorithm and to determine the accuracy level of revenue predictions using the Mean Absolute Percentage Error (MAPE).

ALGORITHM ANALYSIS AND SYSTEM DESIGN 2.1 Algorithm Analysis
In developing this system, the Least Square algorithm will be used to predict sales revenue at Djuju Grocery Store for the next period. For this research, the system will collect data from 12 periods of Djuju Grocery Store, and the forecasted revenue for the following period (month) will be managed using this algorithm.
Djuju Grocery Store has been using manual calculations and predictions for revenue, making it difficult to estimate targets and predict revenue and profit. This is because making manual reports for predictions takes a long time, and as a result, they are not able to determine or ensure that revenue and profit will increase or decrease in the following month. Sometimes, there is not enough money left to purchase inventory, especially when there is an increase in demand for goods. This can cause some customers to think that Djuju Grocery Store does not sell out-of-stock items, which may lead them to buy from other grocery stores.
This situation can lead to a loss of customers and revenue. With this forecasting system, Djuju Grocery Store can easily predict monthly revenue for each sale, ensuring that the amount of sales revenue each month is optimized.
To obtain monthly sales revenue data, this research will use sales book records from Djuju Grocery Store from January 2022 to December 2022. This data will be processed through an Excel file for use in the forecasting application. The prediction process starts by finding the x-value in the actual data, then finding the x 2 , xY, ∑Y, ∑xY, ∑x 2 , and n values. Next, the values of a and b will be calculated. Finally, the forecast and accuracy rate will be calculated.
The Least Square algorithm, also known as the Least Squares Method, is a technique used to forecast or predict sales in the upcoming periods by utilizing time series or periodic data from previous periods [7]. Nevertheless, LSM is extensively employed in fitting data by seeking the optimal fit that minimizes the sum of squared residuals [8].
The steps of least square in this research include the following: 1. Input the actual sales data in a certain period. 2. Calculate the length of the prediction time period. 3. Calculate the values of x2, xY, ∑Y, ∑xY, ∑x2, and n. 4. Then, calculate the total trend value (a) and the change in trend value (b) against time x. 5. Input the month and year to be predicted. 6. Calculate the prediction value using the equation Y = a + bx.
(1) 7. Display the prediction results and forecast error or accuracy level with MAPE.

System Design
System design aims to provide a description of the planning for the construction or development of a system. In this stage, it will be explained how the system will function in terms of the user interface display and modeling diagram.

a. Activity Diagram
The activity diagram of signin depicts the workflow of the system when the user performs the authentication process of signin in the system. System features can be used when the user has been authenticated through sign-in in the system, which can be seen in Figure 1. Meanwhile, the activity diagram of revenue prediction illustrates the workflow of the system when the user performs the process to calculate and display revenue prediction results for the next period in the system, which can be seen in Figure 2.

b. User Interface Display
User interface Display is a graphical display that directly interacts with users. The user interface serves as a means of connecting users and the operating system. In the implementation stage of this interface, it will be described how the interface for the monthly sales revenue prediction system using the Least Square Algorithm will be displayed to users.

TESTING AND RESULT
After completing the development of a monthly sales revenue prediction system for Djuju's Grocery Store using the Least Square Algorithm, it is necessary to conduct testing on the algorithm and the prediction results of the system. The testing aims to ensure that the system operates as planned and to evaluate its accuracy.

Testing and Prediction Calculation
The author conducted a test to predict monthly revenue by adding the next few periods, namely June 2023, based on the actual monthly revenue sales data at Djuju's Grocery Store in the period of January 2022 to December 2022. The goal is to find the revenue result in a certain period that has the smallest MAPE error rate or accuracy level. Here is the sales revenue data from January 2022 to December 2022, along with the calculation using the algorithm as follows [9]. Table 1 shows the actual monthly revenue data from January 2022 to December 2022 that is used to predict the revenue for June 2023. Table 2 displays the calculation results and total result of the x, xY, and x 2 values for the actual revenue data.
To find the revenue amount in June 2023, the least square algorithm was used, which started by calculating the value of x for June 2023. This was done by calculating the value of x from the last available data point and adding 2 successively for 6 times until June 2023. So, if the value of x for the last data point is 11, then the calculation is 11 + 2 + 2 + 2 + 2 + 2 = 23. So, the calculation of the x value for June 2023 is obtained, which is 23.

Journal of Electrical Engineering and Computer Sciences
After finding the values of a and b, the calculation to determine the total revenue amount for June 2023 is as follows:

Result The Accuracy Level or Error Rate
During the testing, a search for the best accuracy level was conducted using the MAPE from the actual monthly revenue data of 2022.
Before calculating the MAPE value, first calculate the predicted revenue and percentage error for each actual data. Table 3 shows the predicted values and percentage error (PE) of each actual monthly revenue data from January 2022 to December 2022. After calculating the prediction values and percentage errors for all actual data, the next step is to sum up all the percentage errors from each actual dataset, then the MAPE value can be calculated using the following formula: Based on the calculation of MAPE above, the predicted revenue for June 2023 is 2.837.687,76 IDR or 2837687,76 and the accuracy level of the revenue forecast is 12.71%, which means the prediction accuracy is in the "good" range according to the forecast criteria. The criteria for accuracy level or error rate can be seen in Table 4 [10].