← All guides

Query Objects for Retail Answers: Building Reusable Excel and Analysis Queries

Reporting & analytics · 7 min read · By Dex Carter · Published 2026-10-26 · Last updated 2026-10-26

Two bound stacks of tabbed ledger printouts on a back-office desk beside a notebook flowchart and a magnifying glass
Joining ledger entries to master data once, so every store analyses the same dataset.

The reflex goes like this: a retail question gets asked every week, so someone commissions a new report. A developer builds it, the report lands in a menu, and three months later nobody can find it, while the same question is being answered in a spreadsheet anyway. Most recurring retail questions do not need a new report. They need the right one of three existing routes: an analysis-mode tab, a reusable AL query object, or an Excel route. Picking the wrong route is what creates the report graveyard.

The misconception: recurring means report

A report is a fixed artefact: fixed layout, fixed filters, fixed audience. A recurring question is none of those things. The stores asking it change, the period changes, and the follow-up question, "fine, but split that by location", arrives within a minute of the first answer. What the question actually needs is a fixed definition: the same tables, the same joins, the same fields, every time. The presentation can stay flexible. That distinction is what separates the three routes below.

Analysis mode already covers more of this ground than it gets credit for. It is a PivotTable-like view on list pages, with a Columns pane, pivot drop zones (Row Groups, Column Labels, Values, Filters) and per-user analysis tabs. For a question that lives entirely on one list page, that is the whole answer, no build, no deployment, no report request.

What a query object buys you over a saved tab

An analysis tab has two limits. First, it works on the fields the list page carries. Second, it belongs to one user: tabs are per-user, and although a tab can be shared by copy-link, with Business Central permissions still applying to whoever opens it, each recipient works on their own copy, not on one governed definition.

An analysis query removes the first limit and softens the second. Analysis queries are AL objects designed to join ledger entry tables with relevant master data to enrich analysis scenarios. The entries say what happened; the master data says what it happened to, the item, the customer, the location dimension the list page never carried side by side. One query object, defined once in AL, gives every store the same joined dataset to analyse, instead of each store rebuilding the logic in its own tab.

One version note for planning: related-table fields in analysis mode are on by default from version 27. On earlier versions, check what a tab can actually see before concluding that a question needs a query object, the field may simply not be switched on yet.

The decision: query, analysis tab, or Excel, by question type

Question shapeRouteWhy
Asked once, or by one person, and one list page holds all the fields Analysis tab The pivot drop zones and per-tab filters answer it in minutes; nothing to build or govern
Asked every week, by several stores, and the answer needs ledger entries joined to master data the list does not show AL query object The join is defined once in AL and reused; every store analyses the same dataset instead of private copies
The analysis is right, but the answer must live on as an Excel evaluation with its own sheets Excel route, with a check first Tools exist to import a page analysis into Excel, but a query-based analysis may not import (see the constraint below)
A fixed document, on a fixed schedule, for a fixed audience That one really is a report Nothing above beats a report when layout, timing and audience never change

The Excel constraint deserves its own paragraph, because it reverses the obvious order of work. The NAVAX Excel Report Builder can import an analysis from a page's analysis mode into an evaluation with a data sheet and an optional PivotTable sheet, in Business Central 24 and later. But analyses based on a Query cannot be imported in that tool, they do not result in meaningful evaluations. So if the end product must be an Excel evaluation built that way, building the question as a query object first paints it into a corner. Decide the destination before choosing the vehicle.

Anatomy of an analysis query: entries joined to master data

Microsoft's BCTech sample library documents the pattern, with the FixedAssetsAnalysis query as the documented example. No retail-specific sample query was found in the sources behind this guide, the sample library is generic Business Central, so treat the steps below as the documented pattern applied to a retail question, not as a named LS Central artefact.

  1. Name the ledger entry table that holds the events: the posted entries behind the question, not a summary table someone built earlier.
  2. Name the master data the answer needs beside those entries, the item, customer or location records that give the entries their meaning. Analysis queries exist to make exactly this join.
  3. Build the query as an AL object on that pattern: entry table joined to the master data, with the fields the analysis will group and sum.
  4. Expose it for analysis: query integration works through page extensions that add analysis actions, so users reach the query from a page rather than from a developer tool.
  5. Open the query in analysis mode and arrange the drop zones, master-data fields into Row Groups, the entry amounts into Values, so the first view a user sees is already the shape of the recurring question.

What success looks like: two different stores open the same query, apply their own location filter, and get answers built from identical joins and fields. If each store had to add its own fields first, the query was not finished.

Permissions and the missing Analyze button

When the Analyze action does not appear, the cause is usually access, not a broken page. Users need the DATA ANALYSIS, EXEC permission set, system object 9640, before the Analyze action appears. The feature can also be disabled per page via the AnalysisModeEnabled property, so a page with no Analyze action at all is a deliberate configuration until proven otherwise. Check the permission set first, then the page, then raise a defect, in that order.

Verify the query answer against the list it came from

A reusable query earns trust once, at build time, by surviving one comparison:

  1. Open the underlying list page and set the same period and location filters the query analysis uses.
  2. Total the matching amount column on the filtered list.
  3. Compare it with the query analysis grand total for the same scope.
  4. If the two differ, the join is the first suspect: a join to master data can drop or multiply entry rows, and either error shows up as a total that almost, but does not quite, match.

What success looks like: the totals match exactly, for two different filter scopes, not just the one the query was built around. Only then is the query the thing every store should use, one question, one definition, asked the same way everywhere.

, Dex Carter, Tech Writer

IndexBack to all guides →