Rivilė Sales Margin: Product and Customer Analysis in Power BI

Rivilė already holds all the data you need to calculate sales margin. Every sales line stores the amount excluding VAT and the cost of sales. Working out the margin is not difficult. What is harder is seeing it consistently, by product, customer and period, without moving the data into Excel every month. That is why the most reliable approach is a Power BI model that refreshes itself from Rivilė or Finvalda data. Analitika360 offers ready-built report packages of this kind for Rivilė and Finvalda users.

In brief

  • Margin is calculated on the selling price excluding VAT, whereas mark-up is calculated on cost. Mix them up and your prices will be too low.
  • A reliable margin needs sales lines with cost of sales, discounts and returns. Orders, reservations and quotations do not belong in it.
  • Compare products and customers by percentage margin. Break any change in margin down into the effects of price, cost, volume and product mix.
  • A Power BI model connected to Rivilė or Finvalda and refreshing automatically shows margin without any manual work.

Contents

Margin, mark-up and gross margin: how they differ

Even experienced managers often confuse these three measures, yet pricing depends on them.

  1. Margin (%) = (price excl. VAT − cost) ÷ price excl. VAT × 100.
  2. Mark-up (%) = (price excl. VAT − cost) ÷ cost × 100.
  3. Price from target margin = cost ÷ (1 − margin).

Example: a product costs €50 and you sell it for €75 excluding VAT. The mark-up is 50%, while the margin is 33.33%. A common mistake: a manager wants a 40% margin and adds a 40% mark-up to a cost of €60. The result is a price of €84, but the margin is only 28.6%. To achieve a genuine 40% margin, the price has to be 60 ÷ 0.6 = €100.

Auditor Valdas Jagminas distinguishes several levels of margin. Commercial margin (margin I) is what remains of sales revenue after deducting the cost of goods sold. Gross margin (margin II) is what remains after also deducting selling expenses. These measures are calculated in management accounting, not financial accounting. The profit and loss statement covers the company’s entire operations, so it is not suited to assessing day-to-day product profitability. Margin measures show which products earn money and which ones eat into profit.

What data makes margins comparable

A margin is only as reliable as the cost and revenue behind it. Before building a report, agree on four things.

What goes into cost. Lithuanian companies account for inventory under the Business Accounting Standards (VAS), the country’s national accounting rules, with VAS 9 dedicated to inventory. Teaching material from Vilnius University states that the acquisition cost of goods consists of the purchase price less discounts, plus delivery, insurance and storage costs and purchase-related taxes such as customs duty. VAT is not included in cost. If transport is left out of cost, the margin on imported goods will look higher than it really is.

Always excluding VAT. The VAT you collect is not your revenue. If you sell for €121 including 21% VAT, you earn €100. With a cost of €45, the margin is 55%. Calculating it on €121 would give 62.8%, almost 8 percentage points too high.

Comparison of a correct margin and a margin inflated by VAT

Discounts and returns. The State Tax Inspectorate (VMI) states in its commentary on Article 83 of the VAT Law that when a discount is granted or goods are returned, a credit document with a minus sign is issued. Discounts are divided into trade discounts and volume rebates. A volume rebate is often issued later, so it has to be assigned to the customer and period it relates to. Otherwise the customer’s margin will be too high in some months and too low in others.

One definition for everyone. Formulas and fields are locked into a single model. The sales, finance and warehouse teams then stop arguing about whose figure is correct.

Sales margin analysis with Rivilė data

Below we set out the whole route from the Rivilė tables to a working report. At each step we point out where people most often go wrong.

  1. Find the right fields. The Rivilė GAMA documentation describes the sales line table I07_PARD, with the fields I07_KAINA_BE (price excl. VAT), I07_NUOLAIDA (discount percentage), I07_PVM, I07_SUMA (amount excl. VAT) and I07_SAVIKAINA (cost amount). Headers are stored in I06_PARH. For margin, I07_SUMA and I07_SAVIKAINA are all you need. The mistake: calculating from the price including VAT or from the price before discount.
  2. Select genuine sales only. In the I06_OP_TIP field, 51 means a delivery note, 52 a return, while 53, 54 and 55 are an order, a reservation and a quotation. Only sales and returns are included in margin. Include orders and your sales double.
  3. Connect to the data. For Rivilė ERP users, the analytics guide describes the API endpoint GET /bi/collect with the sources SALES_INVOICE_DETAILED, PRODUCT, PRICE and CLIENT. It also recommends incremental refresh, where only new data is loaded each time. We cover this in more detail in our article on the Rivilė API and Power BI. For Rivilė GAMA users, connecting the Firebird data is the relevant route.
  4. Build a star schema. At the centre sits a fact table of sales lines, surrounded by product, customer and date tables. With a model like this, the same margin can be sliced by any dimension.
  5. Define the measures. The foundation is four DAX measures:
Pajamos be PVM = SUM ( Pardavimai[I07_SUMA] )
Savikaina = SUM ( Pardavimai[I07_SAVIKAINA] )
Marža € = [Pajamos be PVM] - [Savikaina]
Marža % = DIVIDE ( [Marža €], [Pajamos be PVM] )
  1. Check against control totals. Revenue and cost of sales for a closed month must match the Rivilė reports. A measure returning a number does not mean the number is right.
  2. Automate the refresh. As long as a report is refreshed by hand, it is out of date within a week.

If you build the report yourself, you have to carry out and maintain these seven steps on your own. In the Analitika360 Rivilė packages, the data connection, the model and the automatic refresh are already in place, so you can start your Rivilė sales analysis from the conclusions rather than the tables. To keep the data clean from the outset, it is worth reviewing how to record sales documents and prices.

Sales margin in Finvalda

The logic in Finvalda is the same. You will need sales lines with the amount excluding VAT and the cost of sales, returns with a minus sign, product and customer records, and a date table. Which data is available depends on how you connect: through the API or through data replication. We describe both routes in our articles on the Finvalda API and Power BI and Rivilė and Finvalda data replication.

Before analysing margins at product level, check that the cost of sales line in the profit and loss statement includes all costs related to the goods sold. How to do this is explained in our guide to the Finvalda profit and loss statement. A practical route to a sales dashboard is set out in our Finvalda sales analysis guide.

Product and customer profitability in Power BI

Once the core measures are working, margin can be analysed from three angles.

Product and customer profitability in Power BI

By product or product group. An article on gross margin management by Gediminas Jagelavičius, a researcher at Kaunas University of Technology (KTU), argues that percentage margin, not gross profit in euros, is the right basis for comparing products and groups. Profit in euros fluctuates heavily with prices and promotions. The same article proposes breaking a margin variance down into four parts in a strict order: the effects of price, cost, volume and product mix. In Power BI, each part can be calculated as a separate measure and shown in a waterfall chart.

By customer. The largest customer does not always earn you the most. An illustrative example:

CustomerRevenue excl. VATCost of salesMargin €Margin %
A€20,000€16,000€4,00020%
B€8,000€5,200€2,80035%
C€12,000€8,400€3,60030%

Customer A brings in the most turnover but has the lowest margin. If that customer is also entitled to an annual volume rebate, the gap widens further. A table like this helps you decide where to apply your discount policy and which customers to offer a different product range. We cover this in more detail in our article on B2B customer segmentation.

By period. The monthly margin, compared with the previous month and the previous year, shows whether a seasonal promotion paid off. For restaurants, the same principle applies to dishes: a dish’s margin is compared with its popularity.

The most common mistakes in interpreting margin

  • Mark-up instead of margin. The price is set to hit a target margin but calculated as a mark-up.
  • VAT in revenue. The margin looks several percentage points higher than it is.
  • Forgotten returns. A product looks profitable even though some of it comes back.
  • Late volume rebates. They reduce the margin of the wrong month and the wrong customer.
  • Different denominators. One department includes transport in cost of sales and another does not, so their margins cannot be compared.

Ready-built Rivilė and Finvalda packages

Analitika360 provides ready-built Power BI report packages for Rivilė and Finvalda users. In the packages, revenue, costs, profit, sales, inventory and debts refresh automatically, with no extra work for the user. SharePoint, Excel, CRM or logistics sources can also be connected alongside the accounting data.

Analitika360

PackagePrice
Rivilė Basic€59 a month
Rivilė PRO€89 a month
Finvalda Basic€59 a month
Finvalda PRO€89 a month
Bespoke projects€70 an hour

If you need customer profitability based on your own discount scheme, or reports for the restaurant, logistics or construction sectors, a bespoke solution is tailored to your company’s processes and existing IT systems.

Our view

Margin analysis rarely stalls because of the formula. It stalls because it has to be pieced together again every month. The accountant exports the sales, sorts out the VAT, removes the orders and adds the returns. By the time the report is ready, the decision is already late.

That is why we build ready-made report sets for Rivilė and Finvalda users that refresh with no extra work for the user. The same rules are applied in the same way every month, so margins for products, customers and periods can be compared with one another.

A manager who sees margin in real time adjusts prices the same week, not a quarter later. That is the advantage we want to give businesses.

Analitika360

FAQ

What is the difference between margin and mark-up?

Margin is calculated on the selling price, mark-up on cost. With a cost of €50 and a price of €75, the mark-up is 50% and the margin 33.33%. To turn a target margin into a price, use the formula: cost ÷ (1 − margin).

Should margin be calculated with or without VAT?

Always without VAT, because the VAT you collect belongs to the state, not to your revenue. In Rivilė, use the I07_SUMA field, which stores the line amount excluding VAT. That way the margin will not be artificially inflated.

Can I see margin for each customer?

Yes, provided the sales lines are linked to the customer table in the model. Power BI then shows the same margin measures by customer, product group and month. It is important to assign returns and volume rebates correctly.

How much does margin analysis in Power BI with Analitika360 cost?

The Rivilė Basic and Finvalda Basic packages cost €59 a month, and the PRO packages €89 a month. Bespoke projects cost €70 an hour. Microsoft Pro and Premium licences can also be purchased through us.

Sources

Paciolis: margin as a measure of profitability

Vilnius University: inventory accounting under VAS 9

VMI: commentary on Article 83 of the VAT Law

Rivilė GAMA guide: transaction tables

Rivilė ERP guide: analytics and data export

KTU: a gross margin management model

Further reading

Using Rivilė?

Analitika360 builds Power BI reports straight from your Rivilė data. They refresh automatically, from €59 a month.

Rivilė reports
Analitika360 client stories

Data that helps you decide

See how companies like yours put Analitika360 reports to work in Power BI.

“
We took the standard R-Keeper report package and they tailored it to us on top of that. It all just works.
TB
Tomas B.restaurant owner
“
Twenty ready-made reports — we didn't have to work out what to ask for. Our Finvalda data is finally something you can look at. Recommended.
IM
Ingrida M.accountant
“
What we liked was that Analitika360 already had a 20-report package for Rivilė users — we didn't have to work out our requirements from scratch. We were up and running quickly, and later they adapted several reports to the specifics of our production. It saved us both time and money.
MK
Marius K.finance director
“
We are a group of companies running Rivilė, and consolidated reporting was always a headache. Analitika360 started from the standard 20-report package and then fitted it to our group structure — we now see everything in one Power BI model, and it refreshes itself.
GJ
Giedrė Jankauskaitėfinancial accountant
“
We run six restaurants on R-Keeper and had long been looking for a way to compare results across sites. The standard 20-report package covered most of what we needed, and reports specific to our group were added later.
AŠ
Andrius Š.director of a restaurant group
“
We came to them on a recommendation, and the ready-made 20-report standard for Finvalda users was a pleasant surprise straight away. Management now gets a clear financial picture every Monday, and I no longer spend days exporting data into Excel.
RP
Rasa Petrauskienėhead of accounting
“
We use Rivilė, but we never had time to build reports from scratch. The 20-report package was exactly what we needed — we had it running within a week.
VP
Vaidas P.retail chain manager
“
We have four cafés on R-Keeper and for a long time we ran them on gut feel. The Analitika360 reports showed us things we had simply never noticed. We now decide on the numbers rather than on guesswork.
LK
Laura Kazlauskienėfinance director of a café group