Grocery Retail Analytics With Databricks Genie
12.08.20268 min read

Grocery Retail Analytics With Databricks Genie

Alexey Kopaev

A replenishment manager looking at a low stock figure usually needs more than the number. Is a delivery already on the way? Will it arrive before the stock runs out? Which supplier should they contact? Answering these questions means bringing sales, inventory and delivery information together.

Audio Version0:00
0:00
Grocery Retail Analytics With Databricks Genie

At DataArt, we built Shop Manager Assistant, a working demo in Databricks AI/BI Genie. Its grocery retail model reflects our experience with grocery operations and fulfilment. We tested questions about sales, replenishment and customer purchasing patterns. The examples and screenshots in this article come from that demo.

With a configured Genie Agent, retail teams can ask questions about their data in natural language. They can analyse sales, stock and deliveries without learning SQL or a BI tool, then ask follow-up questions without sending another request to an analyst. Genie uses the organisation’s data and business definitions to interpret those questions.

The Data Behind the Demo

The model includes sales, orders and order items, products and SKUs, stock, purchase orders, inbound deliveries, suppliers, supplier schedules and a product ordering calendar. A purge log records goods removed from stock, including expired products. Customer records support questions about order frequency and purchasing patterns.

This combination gives us several related areas to explore. A stock question can lead to a delivery question, then to supplier information. Sales can be examined by product or period. Customer orders provide another view of demand.

Demo tables and sample questions in Shop Manager Assistant
Figure 1. Demo tables and sample questions in Shop Manager Assistant. The screenshots show an earlier interface, before Genie Spaces became Genie Agents.

Following a replenishment question

The demo log includes questions that fit a replenishment workflow:

  • What is the current stock level of Chocolate Fruit & Nut Mix?
  • What products may run out of stock soon?
  • What products will be delivered from suppliers tomorrow?

There are also follow-up requests for delivery quantities and supplier information. These details matter when someone is deciding whether to raise an order or check an existing delivery.

Consider how a manager could use this sequence. They first check the stock of a product. They then compare it with expected demand and incoming deliveries. If the next delivery appears too late, they ask for the supplier details needed to investigate. If stock is already on its way, they can check that order before placing another one.

The business rules determine whether that analysis is useful. A replenishment query needs to distinguish an open purchase order from a confirmed delivery. It should account for quantities still outstanding, including partial receipts. Products with a short remaining shelf life may need different treatment from stock that can be sold over several weeks.

Genie can help assemble the information for this decision. Its generated SQL queries are read-only. Creating or changing a purchase order would remain a separate step in the retailer’s purchasing process.

What the Sales Example Shows

In the captured conversation, the question «What were our sales during the last month?» returns a daily results table and a chart. The table includes the date, day of the week, total sales and total quantity. The response also provides access to the generated code.

A sales question returns a daily table and chart. The displayed dates span July and August
Figure 2. A sales question returns a daily table and chart. The displayed dates span July and August.

The date range is worth examining. «Last month» can mean the previous calendar month or a rolling period ending near the current date. The result shown here spans July and August. A retailer would need to define the intended default and make the selected period clear in the answer.

The next question might ask for a category breakdown or a comparison with an earlier period. The user can develop the analysis without specifying every requirement at the start. The underlying definitions still need to stay consistent throughout the exchange.

Defining the Retail Measures

Before putting a similar assistant into daily use, we would agree the following definitions with the business and data teams.

Sales

Sales can refer to units, gross value or revenue after returns and discounts. VAT treatment and the choice of transaction, dispatch or delivery date can also change the result. The configuration should identify which measure each team uses and give alternatives clear names. A request for «sales» should not silently switch between them.

Stock and Availability

Physical stock, stock available to sell and stock on the shelf answer different questions. Reserved or quarantined units may need to be excluded from available stock, depending on how the source system records them. A store-level quantity alone cannot establish whether an item is on the shelf.

The question «What may run out soon?» needs a time horizon and a demand assumption. A calculation based on recent sales can provide a simple estimate of cover. Promotions, seasonal changes and periods when the product was unavailable can make that estimate misleading. Where a retailer already has a demand forecast, it can become an input to the analysis.

Trading Periods

Retailers may use calendar months or a trading calendar such as 4-4-5 or 4-5-4. «The same week last year» therefore needs an agreed mapping. A calendar dimension can make those periods explicit. Like-for-like comparisons also require a rule for which stores or channels qualify.

Products and Units

A product may have several SKUs, and a supplier’s case may contain multiple selling units. A comparison between stock and incoming deliveries must use compatible quantities. Product, SKU, category and subcategory should remain distinct when the user asks for a ranking or breakdown.

These definitions help Genie interpret a retailer’s questions and produce more accurate, relevant AI-generated answers. Unity Catalog metric views and Genie SQL expressions capture the agreed business measures. Verified example queries show how to apply them. Databricks guidance on curating Genie Agents recommends this structured context to improve response quality.

Text instructions still have a role, including telling Genie when to ask for a missing period or measure. That behaviour needs testing alongside the calculations. For a question about why a product ran out, the answer should distinguish recorded events, such as a late delivery, from an inferred explanation of their effect.

Controlling Access to Retail Data

A production configuration also needs to reflect who is asking. A store manager may need their own location, while an area manager needs several. Customer analysis may belong to a different group altogether.

Genie applies the user’s Unity Catalog data permissions. Row filters and column masks can restrict visible records and sensitive field values. Those policies must be configured for the retailer’s access model. If a team only needs customer segment totals, an appropriately secured aggregated view can provide that scope.

Data freshness matters just as much for operational questions. A correct query against yesterday’s stock can still be unsuitable for an ordering decision today. The assistant should make the relevant data timestamp available, and the team should agree which refresh frequency each workflow requires.

Reviewing the Answers

The Monitoring screen shows the questions asked during the demo and the feedback recorded against them. It includes positive ratings, follow-up requests and a negative rating on a question about quarterly sales.

Demo questions and feedback in Monitoring, including requests for delivery quantities, supplier information and quarter labels
Figure 3. Demo questions and feedback in Monitoring, including requests for delivery quantities, supplier information and quarter labels.

The next visible request after the quarterly question asks for labels such as «Q1 2025» and «Q2 2025». To understand the issue, a reviewer would need to examine the response and its SQL. A rating identifies something to investigate. The review establishes whether the problem lies in the calculation, interpretation or presentation.

For a retailer’s pilot, we recommend a fixed set of test questions with verified reference answers. Examples could include stock for a named SKU, deliveries due tomorrow and sales for a defined trading period. Genie benchmarks support this evaluation. In Chat mode, reference SQL allows the generated results to be compared with the expected results.

Follow-up conversations also need separate checks. «Add the supplier» should preserve the product selection and date range already established. Adding supplier or delivery records should not multiply sales totals through an incorrect join. These are practical tests for whether the model supports the way someone will actually use it.

Taking the Demo Into a Retail Pilot

We would start with one workflow and a small group of intended users. With them, we would select the questions they need answered and agree how to verify the results. The next step is to check whether the required data exists, whether it is current enough and whether the relationships between records support those questions.

Replenishment is one possible starting point. Category teams could use a similar approach to investigate sell-through or waste by range. Procurement teams could explore delivery performance. Customer teams could examine purchase frequency. Each requires its own measures, permissions and test questions. Where the scope differs substantially, a separate Genie Agent may be easier to maintain.

The interface should also fit the user’s routine, with delivery options that reflect how business teams work day to day. For a simple, unified front end, teams can use Genie One, Databricks’ simplified interface for business users. It lets non-technical teams query data and access insights on the web, on mobile devices, or through collaboration platforms without navigating the full Databricks workspace. Alternatively, teams can use tailored Databricks Apps built around specific replenishment or category workflows. They can also integrate Genie directly into existing enterprise systems, such as internal ERPs or store-associate portals, using the Genie Conversation API. Whichever option is chosen, the authentication design needs to preserve the intended data access. This is particularly important when an integration uses a service identity or relies on Unity Catalog user entitlements.

For DataArt, this work combines retail analysis with data engineering. We can help a retailer define the measures, prepare the data model, configure Genie, and validate responses with its users. The goal is to let retail teams answer routine questions themselves and give analysts more time for complex work. A pilot can test this by checking answer quality and how often users complete an analysis without additional support.

Ready to make governed enterprise data easier for every team to use?

DataArt can help you prepare the data, business context, governance, and operating model needed to make Genie a reliable self-service analytics capability.

Contact Us

Subscribe to Our Newsletter

Subscribe now to get a monthly recap of our biggest news delivered to your inbox!

Alexey Kopaev

Subscribe to Our Newsletter

Subscribe now to get a monthly recap of our biggest news delivered to your inbox!

Databricks Genie (AI/BI Genie) is a natural-language, self-service analytics capability that lets business users ask questions of enterprise data without learning BI tools or writing SQL.

Genie is built on Unity Catalog, so every AI-generated query respects existing access controls, row-level security, and column masking. Generated queries are read-only.

No. Users ask questions in plain language, and Genie automatically generates and executes the underlying SQL.

A Genie Space is a domain-specific configuration of curated data assets, business terms, and query patterns (also called a Genie Agent in current Databricks terminology). It's built around a knowledge store of metadata, synonyms, table relationships, and verified query examples.

Genie interprets the question using Unity Catalog metadata and the space's knowledge store, generates a secure read-only SQL query, and returns results as tables and visualizations, asking clarifying questions when needed.

Genie supports sales, marketing, finance, operations, customer support, risk and compliance, and leadership teams, among others, each with its own configured Genie Space.

DataArt designs the data schemas, metadata, and business logic Genie needs, configures Genie Spaces around specific teams, and builds benchmarking and feedback loops to keep answers accurate over time.

Databricks Genie (AI/BI Genie) is a natural-language, self-service analytics capability that lets business users ask questions of enterprise data without learning BI tools or writing SQL.

Genie is built on Unity Catalog, so every AI-generated query respects existing access controls, row-level security, and column masking. Generated queries are read-only.

No. Users ask questions in plain language, and Genie automatically generates and executes the underlying SQL.

A Genie Space is a domain-specific configuration of curated data assets, business terms, and query patterns (also called a Genie Agent in current Databricks terminology). It's built around a knowledge store of metadata, synonyms, table relationships, and verified query examples.

Genie interprets the question using Unity Catalog metadata and the space's knowledge store, generates a secure read-only SQL query, and returns results as tables and visualizations, asking clarifying questions when needed.

Genie supports sales, marketing, finance, operations, customer support, risk and compliance, and leadership teams, among others, each with its own configured Genie Space.

DataArt designs the data schemas, metadata, and business logic Genie needs, configures Genie Spaces around specific teams, and builds benchmarking and feedback loops to keep answers accurate over time.