Dyna­mic KPI and P&L Con­fi­gu­ra­tion in Power BI: A Fle­xi­ble, Con­fi­gu­ra­tion-Dri­ven Approach



What if busi­ness users could change their key per­for­mance indi­ca­tor (KPI) defi­ni­ti­ons and Pro­fit and Loss (P&L) struc­tures in Power BI wit­hout chan­ging the under­ly­ing data model or backend implementation?

This ques­tion inspi­red our pro­ject: buil­ding a fle­xi­ble report­ing solu­tion that sepa­ra­tes busi­ness defi­ni­ti­ons from tech­ni­cal implementation.

In many tra­di­tio­nal report­ing solu­ti­ons, deve­lo­pers embed KPI cal­cu­la­ti­ons, account map­pings, and P&L hier­ar­chies in backend logic or the seman­tic model. As busi­ness requi­re­ments evolve, even rela­tively small chan­ges can require deve­lo­p­ment effort, test­ing, and deploy­ment. This crea­tes par­ti­cu­lar chal­lenges when dif­fe­rent depart­ments or users need dif­fe­rent views of the same finan­cial data.

Our approach makes these defi­ni­ti­ons con­fi­gura­ble. By com­bi­ning Dat­ab­ricks for data pro­ces­sing with Power BI for report­ing and visua­liza­tion, we deve­lo­ped a solu­tion that lets users define their own KPIs, cal­cu­la­ti­ons, and P&L struc­tures while kee­ping the under­ly­ing tech­ni­cal imple­men­ta­tion stable.

In this article, we explore the archi­tec­ture behind the solu­tion, explain how con­fi­gu­ra­tion dri­ves the report­ing expe­ri­ence, and show how mul­ti­ple con­fi­gu­ra­ti­ons can coexist within the same framework.

Esti­ma­ted rea­ding time: 7 minutes

The Core Idea: Sepa­rate Busi­ness Logic from Tech­ni­cal Implementation

The main design prin­ci­ple was simple: busi­ness defi­ni­ti­ons should come from con­fi­gu­ra­tion rather than hard­coded logic.

Ins­tead of embed­ding every account map­ping, KPI for­mula, and hier­ar­chy directly into the pro­ces­sing logic or Power BI report, we moved these defi­ni­ti­ons into con­fi­gu­ra­tion tables.

Users can configure:

  • Which accounts con­tri­bute to each KPI.
  • How the solu­tion cal­cu­la­tes P&L ele­ments, inclu­ding sums and ratios.
  • How KPIs and P&L ele­ments fit into a hierarchy.
  • Which labels and sort orders appear in the report.
  • How many hier­ar­chy levels the report dis­plays, up to six.

For exam­ple, two busi­ness units might use the same under­ly­ing finan­cial data but cal­cu­late ope­ra­ting pro­fit dif­fer­ently or orga­nize their P&L reports accor­ding to dif­fe­rent report­ing standards.

With a con­fi­gu­ra­tion-dri­ven approach, both busi­ness units can use their pre­fer­red defi­ni­ti­ons and report­ing struc­tures wit­hout chan­ging the under­ly­ing tech­ni­cal implementation.

Solu­tion Architecture

The solu­tion uses three con­fi­gu­ra­tion tables, each respon­si­ble for a distinct part of the report­ing logic.

Accounts and KPIs

The first table (Figure 1.) defi­nes the rela­ti­onship bet­ween finan­cial accounts and KPIs. It spe­ci­fies which accounts con­tri­bute to each KPI, allo­wing the com­po­si­tion of a KPI to be chan­ged wit­hout modi­fy­ing the under­ly­ing pro­ces­sing code.

Figure 1. Account and KPIs map­ping with con­fi­gu­ra­tion ID.

For exam­ple, a reve­nue KPI might include seve­ral account groups. If the busi­ness chan­ges which accounts belong to reve­nue, the map­ping can be updated in the configuration.

During data pro­ces­sing, account-level values are assi­gned to the cor­re­spon­ding KPIs accor­ding to these mappings.

Cal­cu­la­ti­ons and Hierarchy

The second table (Figure 2.) defi­nes how P&L hier­ar­chy ele­ments are cal­cu­la­ted from KPIs.

Figure 2. The P&L definition.

It sup­ports aggre­ga­tion-based cal­cu­la­ti­ons, such as sum­ming seve­ral KPIs, as well as ratio cal­cu­la­ti­ons, where one KPI ser­ves as the nume­ra­tor and ano­ther as the denominator.

For exam­ple, a pro­fit mar­gin could be cal­cu­la­ted by divi­ding pro­fit by reve­nue. By sto­ring the cal­cu­la­tion defi­ni­tion in con­fi­gu­ra­tion, the solu­tion can sup­port dif­fe­rent cal­cu­la­tion rules wit­hout requi­ring a new imple­men­ta­tion for each KPI or P&L element.

This crea­tes a con­sis­tent way to manage finan­cial cal­cu­la­ti­ons while allo­wing busi­ness defi­ni­ti­ons to evolve.

P&L Pre­sen­ta­tion

The third table (Figure 3.) con­trols how the P&L is pre­sen­ted in Power BI.

Figure 3. The P&L view definition.

It defi­nes which KPIs and hier­ar­chy ele­ments appear in the report, how they are grou­ped, and where they sit within the hier­ar­chy. It also stores dis­play labels and sort orders, sup­port­ing up to six con­fi­gura­ble hier­ar­chy levels.

This sepa­ra­tion is important because the way finan­cial infor­ma­tion is cal­cu­la­ted does not neces­s­a­rily deter­mine how it should be presented.

For ins­tance, one report might group results by busi­ness unit, while ano­ther orga­ni­zes them by reve­nue, costs, and pro­fi­ta­bi­lity. Both can use the same under­ly­ing data while pre­sen­ting it accor­ding to dif­fe­rent busi­ness requirements.

The Seman­tic Data Model

The seman­tic data model con­nects the pro­ces­sed finan­cial values with the con­fi­gura­ble busi­ness definitions.

At the backend level, account-level finan­cial values are aggre­ga­ted and assi­gned to the cor­re­spon­ding KPIs. The resul­ting values are stored in a fact table, which refe­ren­ces KPIs through their IDs.

Dimen­sion tables pro­vide the infor­ma­tion requi­red to orga­nize these values, inclu­ding the P&L hier­ar­chy and the rela­ti­onships bet­ween KPIs and hier­ar­chy elements.

Power BI uses the KPI IDs to retrieve and aggre­gate the rele­vant values from the fact table. The dimen­sion tables pro­vide the hier­ar­chy, labels, and orde­ring nee­ded to dis­play the results in a P&L matrix.

The key advan­tage is that the finan­cial data and its pre­sen­ta­tion are decou­pled. Chan­ging an account-to-KPI map­ping, adjus­ting a cal­cu­la­tion, or res­truc­tu­ring the hier­ar­chy does not inher­ently require the under­ly­ing finan­cial values to be changed.

Ins­tead, the rele­vant con­fi­gu­ra­tion is updated and incor­po­ra­ted into the pro­ces­sing and report­ing workflow.

This allows the same finan­cial data to sup­port mul­ti­ple busi­ness per­spec­ti­ves wit­hout dupli­ca­ting the entire data model or crea­ting sepa­rate reports for every variation.

Mana­ging Mul­ti­ple Con­fi­gu­ra­ti­ons and Versions

Dif­fe­rent users and busi­ness areas often have dif­fe­rent report­ing requi­re­ments. To accom­mo­date this, every KPI and P&L setup is assi­gned a uni­que con­fi­gu­ra­tion ID.

This ID iden­ti­fies the set of busi­ness defi­ni­ti­ons used for a par­ti­cu­lar report­ing sce­na­rio. It keeps account map­pings, cal­cu­la­tion rules, and pre­sen­ta­tion set­tings asso­cia­ted with the appro­priate configuration.

Mul­ti­ple con­fi­gu­ra­ti­ons can coexist within the same solu­tion, allo­wing dif­fe­rent users to view the P&L accor­ding to their indi­vi­dual requirements.

For exam­ple, a finance team could main­tain a stan­dard cor­po­rate P&L while a busi­ness unit uses a cus­to­mi­zed hier­ar­chy and KPI defi­ni­tion. Both con­fi­gu­ra­ti­ons can refe­rence the same under­ly­ing finan­cial data.

This also makes con­fi­gu­ra­tion chan­ges easier to manage. New defi­ni­ti­ons can be intro­du­ced or exis­ting ones adjus­ted wit­hout buil­ding an enti­rely sepa­rate report­ing solution.

The con­fi­gu­ra­tion ID pro­vi­des the mecha­nism for distin­gu­is­hing these defi­ni­ti­ons; appro­priate fil­te­ring and pro­ces­sing logic ensure that each report uses the inten­ded configuration.

Key Bene­fits of the Approach

The con­fi­gu­ra­tion-dri­ven design offers seve­ral prac­ti­cal advantages:

  • Fle­xi­bi­lity: KPI defi­ni­ti­ons, cal­cu­la­ti­ons, and P&L hier­ar­chies can evolve as busi­ness requi­re­ments change.
  • Reusa­bi­lity: Mul­ti­ple report­ing sce­na­rios can share the same under­ly­ing data and tech­ni­cal framework.
  • Main­taina­bi­lity: Busi­ness defi­ni­ti­ons are sepa­ra­ted from pro­ces­sing logic and the seman­tic model, redu­cing the need for code chan­ges for con­fi­gu­ra­tion-level adjustments.
  • Con­sis­tency: A com­mon pro­ces­sing frame­work helps apply cal­cu­la­tion and map­ping rules consistently.
  • Sca­la­bi­lity: Addi­tio­nal con­fi­gu­ra­ti­ons can be intro­du­ced wit­hout crea­ting a com­ple­tely sepa­rate solu­tion for each busi­ness unit.

There is one important con­side­ra­tion: con­fi­gu­ra­tion chan­ges do not eli­mi­nate every tech­ni­cal depen­dency. New cal­cu­la­tion types, chan­ges to the under­ly­ing data struc­ture, or unsup­ported report­ing requi­re­ments may still require deve­lo­p­ment. The bene­fit is that chan­ges within the sup­ported con­fi­gu­ra­tion frame­work can be mana­ged wit­hout modi­fy­ing the core implementation.

Con­clu­sion

The objec­tive of this pro­ject was to build a fle­xi­ble P&L report­ing frame­work in which busi­ness logic and report pre­sen­ta­tion can be adapted inde­pendently of the under­ly­ing finan­cial data.

By sepa­ra­ting account map­pings, KPI cal­cu­la­ti­ons, hier­ar­chy defi­ni­ti­ons, and pre­sen­ta­tion set­tings into con­fi­gu­ra­tion tables, we crea­ted a solu­tion that sup­ports mul­ti­ple report­ing requi­re­ments within a shared Dat­ab­ricks and Power BI architecture.

The result is a more adap­ta­ble report­ing envi­ron­ment where users can define how finan­cial infor­ma­tion is cal­cu­la­ted, struc­tu­red, and dis­played wit­hout requi­ring a sepa­rate tech­ni­cal imple­men­ta­tion for every variation.

The key takea­way: A con­fi­gu­ra­tion-dri­ven approach turns the P&L from a fixed report into a reusable report­ing frame­work – one that can evolve with busi­ness needs while kee­ping its under­ly­ing data archi­tec­ture stable.