Poli Usp Pro
November 19, 2026
Application of the Shapley Method for KPI Variation Decomposition
Paulo César Gomes Silva; Ronaldo de Lucio
DOI: 10.22167/2675-6528-202603825
Article derived from a Final Course Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.
Summary
The evaluation of changes in Key Performance Indicators (KPIs) is fundamental for business management, but traditional decomposition methods, such as Oaxaca and Blinder, often present disadvantages in the allocation of variations and in the communication of results. Aiming to overcome these limitations, the Shapley method was applied to explain KPI variations between periods, verifying its capacity to produce additive and path-independent decompositions. The research was conducted as a simulated case study/analytical experiment, evaluating the stability and additivity of the Shapley method’s solutions in profitability scenarios of a fictitious retail operation. Quantitative simulations were used, enriching a Kaggle transactional database with artificial instances and implementing the calculation of dimension contribution to margin variations between two quarters. The tools employed were Microsoft Excel and Python (Jupyter Notebook), with libraries such as numpy/pandas and itertools. The results revealed an increase in the average margin between the analyzed quarters, driven mainly by changes in commission pricing and sales category mix. The Shapley method proved to be suitable for decomposing KPI variations, generating additive, symmetric, efficient, and path-independent solutions. It was concluded that the Shapley method offers a robust approach to profitability analysis, allowing for a direct and intuitive evaluation of the impacts attributed to business drivers, which facilitates the optimization of managerial strategies.
Keywords: Profitability Analysis; Marginal Contribution; Business Management; KPI; Shapley.
1. Introduction
In business management, the evaluation of results and comparison with goals are fundamental to the cycle of process configuration and improvement. Key Performance Indicators (KPIs) are metrics established in this context, used to express in a standardized way the achievement of business objectives in a given analysis period (Wannes and Ghannouchi, 2019). Understanding the reasons that lead these values to vary between periods of interest is essential for identifying optimization opportunities in managerial processes, whether for corrective purposes, adjusting managerial levers, or explanatory purposes, generating knowledge about performance factors.
To quantify the influence of factors contributing to the variation of a KPI between periods, decomposition methods for sums or multiplications of variables are widely employed. Among them, the original Oaxaca and Blinder method is frequently used for decompositions (Naszodi, 2021). In this method, the variation of a KPI is expressed as the sum of parts, calculating the total variation if only one variable is changed at a time.
However, this method, although it generates an algebraically simple and intuitive solution, presents significant disadvantages. It demonstrates path dependency for the decomposition of effects, where the order in which variables are considered affects the results (Fortin et al., 2010). Furthermore, it does not always produce efficient solutions, as the joint change of all variables may not coincide with the sum of the results of changes associated with the variables (Kongo, 2023). It also does not guarantee fair solutions when there are interactions between variables, failing to assign equal effects to variables that produce the same KPI variation (Patel, 2024). These characteristics can be detrimental to business decisions, as they may obscure part of the changes or attribute effects to irrelevant variables.
In the context of retail, where sales margin is a commonly monitored KPI, the limitations of the Oaxaca and Blinder method are relevant. It is often important to explain the variation in results considering a hierarchical structure of product sales, assigning fair contributions to departments, categories, or brands. Biewen (2012) proposes an additive decomposition model that considers the interaction between variables, resolving path dependency and efficiency. However, the result of this method can generate solutions with high-degree interaction factors, which can be complex to justify in the corporate environment.
Given these limitations, the Shapley method emerges as a promising alternative. Originally proposed in game theory to fairly distribute the value formed by a coalition of players (Shapley, 1953), it possesses desirable properties for attributing effects to variables in explaining the variation of a KPI. The method adheres to the axioms of efficiency, symmetry (variables with identical contributions receive identical effects), additivity (the contribution of variables is additive when summing distinct variation assessments), and does not attribute effects to variables that do not contribute to the outcome (dummy player). By considering the average marginal contribution that the alteration of each variable adds to the result, the Shapley method generates a path-independent solution (Russell and Norvig, 2023), which motivates its application in this study.
The application of the Shapley method is, therefore, justified by its ability to overcome the deficiencies of traditional decomposition methods, offering a more robust and fair approach to KPI variation analysis. The present work aimed to apply the Shapley method to explain KPI variations between periods, verifying its ability to produce additive and path-independent decompositions.
2. Material and Methods
The research was designed as a simulated case study and analytical experiment, adopting a predominantly quantitative approach. The central objective was to evaluate the stability and additivity of the solutions generated by the Shapley method in various scenarios and data groupings. Specifically, it sought to explain the changes in profitability of a fictitious retail operation, using case simulations to understand the method’s response to different configurations.
The methodological procedures were structured in two main stages. Firstly, an existing transactional database was enriched by inserting artificial instances and facts. Secondly, the calculation of the contribution of selected dimensions was implemented, aiming to explain the margin variations observed between two analysis periods.
For the execution of these steps, specific software tools were employed. The enrichment of the transactional base and the implementation of Shapley value calculations were performed using Microsoft Excel and the Python programming language, in the Jupyter Notebook environment. The Python libraries used in the creation of the algorithms included numpy and pandas, for matrix and dataframe manipulation, itertools, for the exhaustive generation of element permutations, and tqdm, for monitoring loop speed.
The unit of analysis consisted of simulated profitability scenarios for a retail operation. The initial database for the study was the “Online Sales Dataset – Popular Marketplace Data” set, made available on Kaggle (Kaggle, 2024). This original dataset contained 240 transactions, with dimensions such as product category sold, sales region, and payment method, which were subsequently used as *drivers* for explaining the results.
The original database presented limitations in terms of cross-referencing variables, which would restrict the evaluation of scenarios where multiple *drivers* underwent simultaneous changes. To overcome this limitation and enable the analysis of impacts by Shapley value, new instances were artificially created. The initial set was replicated, and the dimension fields were assigned randomly.
To simulate the financial impact of the transactions, artificial revenue and cost facts were created for each of them. This was done by arbitrarily determining pricing rules. These rules linked the base dimensions and the transaction date to specific commission (*fee*) and processing (*processing*) rates, which were applied to the transacted amount (total revenue) as multipliers, generating the absolute values of *fee_total* and *processing_total*.
The percentage margin (M) of a transaction or a set of transactions was defined as the ratio between the difference of the total commission (*fee_total*) and the total processing costs (*processing_total*) by the total transacted value (*receita_total*). Commission revenues (F) and processing costs (C) were also expressed as percentages of total revenue, in a manner analogous to the definition of the margin.
The calculation of the Shapley value for transaction groupings was based on cooperative game theory, as defined by Cano-Berlanga et al. (2019). The Shapley value (Φi) for a player (i) was determined as the average of the marginal contributions that this player adds to the outcome, considering all possible orders of participation in a coalition of players.
The application of Shapley value aimed to estimate the contribution of variables such as commission pricing and costs, payment method mix, region, and sales category. These variables were interpreted as “players” in the variation of KPIs such as margin, commission, and average costs. The variation in average commission (F) between the first and second quarters of a year was treated as a “game”, where the explanatory variables of sales revenue mix and the performed fee for each combination of variables acted as “players”.
The decomposition of the results for each quarter was performed using weighted averages of the *fees* generated from sales for each combination present in the period’s transactions. The contribution of a specific combination of category, region, and payment method to the average *fee* for a quarter was calculated considering the relationship between revenue *shares* and the *fee* generated. The total difference in the average *fee* between the two periods was expressed by the sum of the total contributions of all combinations of category, region, and payment methods. To calculate the marginal contribution of each variable, all n! possible sequences of variable combinations were considered, determining their marginal contributions. This reasoning was applied to all KPIs, allowing for an understanding of the impact of each *driver* on the margin, either through the direct decomposition of the percentage margin (M) or by adding the decompositions of commission (F) and costs (C).
The evaluation of the methodology consisted of verifying the expected properties for decomposition by the Shapley method. Simplified and complex margin decomposition scenarios were used. In all cases, the KPIs were compared between the first and second quarters of the adapted transaction base. The results were verified for the axioms of efficiency, symmetry, dummy player, and additivity of solutions.
The study’s validation was performed by comparing the results generated by the Shapley method with expected results, obtained in a logical-mathematical or deterministic manner, using purposefully simplified versions of the generated database. The present work did not aim to mathematically demonstrate these properties, but rather to experiment with them through simulations calculated according to the tool available in the literature.
3. Results and Discussion
The profitability analysis of the simulated retail operation, focused on the average margin between the first and second quarters, revealed an increase of 0.57 percentage points, equivalent to 57 basis points. This positive variation in margin was predominantly driven by changes in the average commission percentage, which contributed 49 basis points to the growth. The remaining increase, approximately 9 basis points, was attributed to the rise in the average transaction processing cost. These initial findings set the stage for a deeper investigation into the underlying factors of these changes, using the Shapley method to decompose contributions more granularly.
The application of the Shapley method allowed for a detailed decomposition of the average commission variation, which increased from 19.32% in the first quarter to 19.80% in the second. This analysis revealed that the main driver of the commission increase was the pricing effect, contributing 0.32 percentage points. Subsequently, changes in the sales category mix also exerted a significant positive influence, adding 0.21 percentage points to the commission variation. These results highlight the importance of both pricing strategies and sales composition by category for commission performance.
In contrast to the positive effects observed, changes in the region mix and payment method mix presented marginal negative contributions, albeit of smaller magnitude. The region effect subtracted 0.02 percentage points, and the payment method effect also reduced the commission by 0.02 percentage points. The sum of these individual contributions – pricing, category mix, region mix, and payment method mix – totaled the increase of 0.49 percentage points in the average commission, demonstrating the additive property of the Shapley method in allocating the total variation among the considered drivers.
Regarding the variation in the average processing cost, which rose from -1.89% to -1.80% between quarters, the Shapley method also provided an enlightening decomposition. Changes in the payment method mix were the main driver of the increase, contributing 0.07 percentage points to the cost variation. The region mix also had a positive impact, adding 0.04 percentage points. These data indicate that the composition of transactions by payment method and region influenced the dynamics of processing costs.
On the other hand, the pricing effect on processing costs resulted in a negative contribution of -0.01 percentage points, while changes in category mix also contributed negatively with -0.02 percentage points. The sum of these contributions to the processing cost totaled 0.09 percentage points, confirming the Shapley method’s ability to additively distribute the total KPI variation among the explanatory factors. This granularity is crucial for management, allowing for the identification of which specific levers are impacting costs.
Upon consolidating the findings, the most relevant events for the margin increase were the pricing effect on commissions, which contributed 31.7 basis points, and the category mix effect on commissions, responsible for 21.4 basis points. Together, these two factors explained approximately 92% of the total margin movement. This concentration of explanation in a few key drivers facilitates the identification of strategic areas for intervention and optimization, aligning with the objective of providing actionable insights for business management.
The detailed analysis by product category revealed specific dynamics that contributed to the variation in average commission. The Electronics category, for example, demonstrated a significant positive impact, with an increase in average commission from 19.00% to 20.00% and a substantial growth in its share of total revenue, from 40.31% to 51.28%. The Shapley decomposition for Electronics indicated a contribution of 2.08 percentage points from the category effect and 0.46 percentage points from the pricing effect, totaling an impact of 2.60 percentage points, which reflects the combination of share gain and commission increase.
In contrast, the Home Appliances category showed a negative contribution to the average commission variation. The average commission for this category decreased from 20.00% to 19.00%, and its share of total revenue also experienced a considerable drop, from 26.44% to 19.30%. The Shapley method attributed -1.34 percentage points to the category effect and -0.23 percentage points to the pricing effect, resulting in a total contribution of -1.62 percentage points. This analysis highlights that the loss of share and the reduction in commission contributed to the category’s negative performance.
The Clothing category also exhibited a negative contribution, with the average commission falling from 18.00% to 17.00% and a reduction in revenue share from 10.69% to 7.70%. The Shapley method indicated a category effect of -0.59 percentage points and a pricing effect of -0.09 percentage points, totaling -0.62 percentage points. Although it may seem counterintuitive, this negative contribution is a consequence of the interaction between the relevance of mix-pricing and the decrease in the category’s commission and share, which was already operating below average in the first quarter, according to the logic of additive decomposition.
The Sports category, in turn, demonstrated positive behavior, with the average commission increasing from 21.00% to 22.00% and a slight rise in revenue participation, from 16.19% to 17.97%. The Shapley decomposition for Sports revealed a contribution of 0.56 percentage points from the category effect and 0.17 percentage points from the pricing effect, totaling 0.56 percentage points. These results illustrate how the Shapley method can capture and quantify the contributions of different drivers, even in scenarios of complex mix and pricing variations.
The verification of the Shapley method’s properties confirmed its suitability for KPI decomposition. The efficiency property was demonstrated by the equivalence between the total variation of the average commission (49 basis points) and the sum of the contributions attributed to the effects of category mix, region, payment method, and pricing. This characteristic is fundamental to ensuring that all observed variation is explained by the drivers, avoiding the need for residual categories such as “others” or “interaction effects,” which can obscure managerial analysis.
The fictitious player property was evaluated in a simplified scenario, where the representativeness of the Electronics category did not vary between quarters. In this case, the total effects related to category mix, region, and payment method were null. This occurred because there was no variation in the representativeness of Electronics and because region and payment method are not variables for defining the commission for this category. Thus, all variation between periods was faithfully explained by the pricing effect, confirming that the method does not attribute effects to variables that do not contribute to the result.
The additivity of the method was observed when summing the contributions of each region to the increase in the sector’s average commission, resulting in a 1 percentage point change in pricing between quarters. This ability to consistently sum contributions is vital for understanding how different factors combine to generate the final outcome. Symmetry was also evidenced by the proportionality of the pricing effect in each region, reflecting the relevance of each of them in total revenue, with Asia contributing 32%, Europe 43%, and North America 24% of the average revenue for the periods.
Although the Shapley method offers a robust and intuitive approach to decomposing KPI variations, scenarios have been identified where the interpretation of effects can be more challenging. In these cases, the understanding that the Shapley value represents the average of a driver’s marginal contributions, considering all possible orders of its entry into a coalition, is crucial. This perspective ensures that, even in complex situations with variable interactions, the value attribution is fair and independent of the analytical path, overcoming the limitations of traditional methods such as Oaxaca and Blinder.
In summary, the application of the Shapley method to explain KPI variations in the simulated retail operation demonstrated its effectiveness in producing additive, symmetric, efficient, and path-independent analytical decompositions. The results revealed that the increase in average margin was primarily driven by changes in commission pricing and sales category mix, with the method allowing for a direct and intuitive evaluation of the impacts attributed to each business driver. This capacity for fair and transparent attribution is fundamental for optimizing managerial strategies and improving decision-making in the corporate environment.
4. Conclusion
This study sought to apply the Shapley method to explain variations in Key Performance Indicators (KPIs) between periods, verifying its capacity to produce additive and path-independent decompositions. An increase in the average margin in the simulated retail operation was observed, driven mainly by changes in the commission percentage and the increase in processing costs. The decomposition revealed that the pricing effect on commissions and the sales category mix were the most relevant factors for the margin increase. For processing costs, changes in the payment method mix and region showed the greatest impact. The application of the Shapley method demonstrated its effectiveness in generating additive, symmetric, efficient, and path-independent analytical solutions, overcoming the disadvantages of traditional methods.
The study’s main contribution lies in validating the Shapley method as a robust tool for profitability analysis, enabling a direct and intuitive assessment of the impacts attributed to business drivers. This fair and transparent attribution capability is fundamental for optimizing managerial strategies and improving decision-making in the corporate environment. Although the method offers an intuitive approach, it was observed that interpreting the effects can be more challenging in certain scenarios, requiring an understanding of the Shapley value as the average of marginal contributions.
Bibliographic References
Biewen, M. 2012. Additive decompositions with interaction effects. IZA Discussion Papers (6730): n.d.
Cano-Berlanga, S.; Giménez-Gómez, J.; Villela, C. 2019. Quantitative game theory applied to economic problems. p. 281-307. In: Vinod, H., Rao, C. Handbook of Statitics. Elsevier, Oxford, UK.
Fortin, N.; Lemieux, T.; Firpo, S. 2010. Decomposition methods in economics. Disponível em: <https://www.nber.org/system/files/working_papers/w16045/w16045.pdf>. Acesso em: 17 out. 2025.
Kaggle. 2024. Online sales dataset: popular marketplace data. Disponível em: <https://www.kaggle.com/datasets/shreyanshverma27/online-sales-dataset-popular-marketplace-data>. Acesso em: 28 out. 2025.
Kongo, T. 2023. Efficient and fair solutions in cooperative games. Disponível em: <https://www.jape-net.org/conference14_papers/Kongo.pdf>. Acesso em: 21 nov. 2025.
Naszodi, A. 2021. Decomposition scheme matters more than you may think. European Commission, Bruxelas, Bélgica. Disponível em: <https://publications.jrc.ec.europa.eu/repository/handle/JRC125119>. Acesso em: 25 nov. 2025.
Patel, R. 2024. Fair and additive decomposition of metric components. Disponível em: <https://ssrn.com/abstract=4916155>. Acesso em: 7 jun. 2025.
Russel, S.; Norvieg, P. 2023. Inteligência artificial – uma abordagem moderna. 4ed. Grupo Editorial Nacional, Rio de Janeiro, RJ, Brasil.
Shapley, L.S. 1953. A value for n-person games. In: Annals of Mathematical Studies, 1953, Princeton, New Jersey, U.S.A. Anais…307-317.
Wannes, A.; Ghannouchi, S.A. 2019. KPI-Based Approach for Business Process Improvement. Procedia Computer Science (164): 265-270.
Article originating from the Course Conclusion Work of the Specialization in Data Science and Analytics of the MBA USP/Esalq
To learn more about the course, click here and access the MBX Academy platform