Alya Books

    Help centre

    Guides for Alya Books and UAE e-invoicing

    Custom reports and KPIs

    Build your own report from the ledger lines, open items, item sales, a statement or a library report: group the rows by any dimension with subtotals, add period columns compared with the previous period, the previous year or a budget, add formula columns, filter, drill every figure to its ledger lines, save it and export it; start from a pack template, let the assistant draft one, and read the pack's KPIs.

    Build a report

    Reports → Library → Build a report opens the report builder (/accounting/reports/build). It has five cards, top to bottom:

    • Source: what the report reads: Ledger lines, Open items, Item sales, A statement, A library report or KPIs; the From and To dates of the preview; and Entities (see Over an entity group).
    • Columns: each column is a Dimension (account, account group, department, class, location, project, cost centre, contact, book, entity), a Measure (Net, Debit, Credit, Balance, Count), a Period (a measure over a range, one total or one column per month, quarter or year, compared with Previous period, Previous year or Budget) or a Formula over earlier columns. Every column has a key (lower-case letters, digits and underscores), a name and an Arabic name. Drag a column by its handle to move it.
    • Rows: Group by one dimension and Then by a second; Subtotals adds a line after each group. A period column compared with Budget needs Group by Account or Account group (a budget is set per account); with any other grouping the Rows card says so and the preview is refused.
    • Filters: only the ledger lines that meet these conditions count (All of these, Any of these, Not, and groups inside groups): account code, account type, account group, the dimensions, the contact, the book and the dates.
    • Preview: the layout run on your books with the row count. Click a figure to see the ledger lines behind it.

    Save as a definition names the report (name, key, Arabic name); Excel and PDF in the header export it.

    Walkthrough: expenses by department for twelve months with a variance column

    1. Reports → Library → Build a report.
    2. Source: Ledger lines.
    3. Columns → Add a column: kind Period, key amount, name "Expenses", measure Net, Period Last 12 months, Columns per Month, Compare with Previous year. The preview shows twelve monthly columns, the twelve months of the year before and the totals.
    4. Add a column: kind Formula, key variance_pct, name "Variance %", formula percent(amount - amount_compare, amount_compare), Number format Percent (the column then reads 12.5%, not an amount). Click the chips under the formula to insert the earlier columns and the functions instead of typing them.
    5. Rows: Group by Department, Then by Class, Subtotals on. Each department is a group with its classes and a subtotal line.
    6. Filters: Add a condition: Account type is one of expense, expense_depreciation, expense_other (or Account code between 5000 and 5999).
    7. Preview: click one month of one department. The Lines behind this figure panel lists the ledger lines with the date, the entry, the account, the description, the contact, the debit and the credit; open an entry from there.
    8. Save as a definition: name "Expenses by department", key expenses_by_department, the Arabic name, Save. The report joins the Custom reports group of the library.
    9. Excel and PDF: both files carry every column and every row, not only the preview's page.
    10. Pin it later: from the dashboards milestone, a saved definition is a dashboard widget you can add to your dashboard. Until then, run it from the library or schedule it with a report package.

    In the library the Custom reports card lists your reports with Run, and the menu holds Edit (opens the builder on it), Duplicate (saves a copy named "(copy)") and Delete (asks first; schedules and dashboards that use it stop finding it).

    Templates

    Start from a template in the builder's header lists the country pack's layouts; Use fills the builder with one, and you change anything before you save. The five report templates:

    TemplateWhat it lays out
    Expenses by dimensionExpenses by department and class for the last twelve months against the previous year, with the variance (the walkthrough above)
    Sales by customerNet sales per customer from the posted invoices and credit notes, with each customer's share
    Sales by itemNet sales and quantity per item from the posted invoices and credit notes
    Balance by entityAccount group balances per entity of an entity group at the end of the year (choose the group when you run it)
    Twelve-month trendIncome and expenses by account group, month by month over the last twelve months, with the running total

    The same list shows the pack's KPIs, marked KPI.

    The two templates read invoices and credit notes, so they are named as sales: revenue is what the ledger recognises, and the report library's Revenue by customer (from revenue recognition) shows that. A quantity or a count prints as a number, never as an amount.

    Revenue per item comes from invoices

    The ledger books revenue per account, not per item, so a report over Item sales (the Sales by item template and any report you build on that source) reads the lines of the posted invoices and credit notes instead: each line's net amount in your base currency at the document's rate, credit notes as negatives. The figure comes from invoices, not from the ledger.

    Under such a report, in the builder's preview and in the library, one line sets the two side by side: From invoices (the report's total), Ledger revenue for the same dates (the movement of the income accounts in the trial balance) and, when they differ, the Difference on an amber line. A difference is not an error in the report: the ledger's revenue also moves with manual journals, deferred revenue, invoice lines posted to an account that is not income, and a year-end closing entry. Open the trial balance for the income accounts over the same dates to find which.

    Ask the assistant to build one

    Ask the assistant in a sentence: "expenses by department for the last twelve months with a variance column", "revenue by customer", "build the same report for the Jeddah entity". The assistant reads what the builder offers (the sources, dimensions, statements, KPIs and entity groups), proposes a definition with draft_report_definition and shows it in an action card: the columns, how it read your sentence and the preview. Nothing is saved yet. When you confirm, it saves the report with save_report_definition (which always asks first). An agent whose member lacks the prepare class cannot draft or save one; it is refused with role_forbidden.

    KPIs

    A KPI is a custom definition whose source is KPIs: one value, a formula over figures of the statements (or over other KPIs, kpi:<key>), with its format (percent, ratio, days, amount, number) and its drill. The pack ships six, each year to date:

    KPIFormula
    Gross margin %gross profit as a percent of revenue
    Current ratiocurrent assets ÷ current liabilities, at the end of the period
    Days sales outstanding (DSO)trade receivables ÷ revenue × the days of the period
    Days payables outstanding (DPO)trade payables ÷ (cost of sales + operating expenses) × the days of the period
    Operating expense ratiooperating expenses as a percent of revenue
    Revenue growthrevenue against the same period a year earlier, in percent

    Each KPI card shows the value, a sparkline of the last twelve months and See what is behind it, which opens the statement the figure comes from in the library. The firm sees the same cards on a client's Metrics tab (see The client list). To build your own, choose the source KPIs, add one Measure column per figure (a statement row or another KPI) and a Formula column over them.

    Formulas

    A formula column reads the keys of the earlier columns and these functions:

    • percent(a, b): a as a percent of b (empty when b is zero).
    • share(x): x as a percent of the column's total (the whole formula of its column).
    • running(x): the running total of x down the rows (the whole formula of its column).
    • <column>_compare: the sum of a period column's comparison columns (previous period, previous year or budget); <column> is the sum of its own columns.
    • <column>_total: a period column's total over its months.

    The arithmetic operators + - * / and brackets work as usual. A KPI formula may also read days, the days of the period.

    Number format

    Every Measure, Period and Formula column has a Number format under its settings. It says how the column's figures print; it never changes a figure.

    FormatPrintsUse it for
    Amount (money)AED 1,234.50 on screen, 1,234.50 in a filemoney; the default, and what a report saved earlier keeps
    Number1,234 (up to three decimals, none when whole)a count or a quantity
    Percent34.6% (one decimal)percent(a, b), share(x) and any formula whose result is a percentage
    Ratio1.50 (two decimals)one figure divided by another
    Days41.25a number of days

    A period column gives its format to each of its month, quarter or year columns, to its comparison columns and to its totals. The preview, the library's table, a dashboard widget, Excel, PDF and Word, the API's export and the files of a scheduled report all print the column the same way, in English and in Arabic. In Excel the cell holds the number itself and the format is the cell's number format, so you can still sum and sort the column.

    A column that is a dimension has no number format. A KPI keeps its one format in the Source card. Over the API a column carries format (amount, number, percent, ratio or days); another value is refused with invalid_layout.

    Limits

    • At most 36 period columns in one run (for example 36 months, or 18 months with their comparison); more is refused with period_limit.
    • At most 5,000 rows per page; a larger report is paged. The preview shows one page at a time; Excel and PDF in the builder take every row.

    Plans

    The builder (your own layouts, the preview, Save and Export) is in Professional and above. On another plan the builder says "The report builder is in Professional" and you can still lay a report out; saving one is refused with feature_not_in_plan. The pack's templates and KPIs run on every plan: the KPI cards and the client Metrics tab need no upgrade.

    Over an entity group

    When your organisation belongs to an entity group, Entities in the Source card offers the group beside This organisation only. The report then reads the ledger lines of the group's member organisations, and the Entity dimension groups the rows by organisation. Only the entities you may open count: a member organisation you cannot open is left out of the figures and the drill, as in the consolidated statements.

    API and assistants

    • GET /reports/templates: the pack's templates and KPIs with their layouts.
    • PUT /reports/definitions/{key} with kind: "custom", a name and a layout saves a custom report; GET /reports/definitions?kind=custom lists them; DELETE /reports/definitions/{key} deletes one.
    • GET /reports/{key}?from=&to= runs it; GET /reports/{key}/export?format=xlsx|pdf exports it.
    • GET /reports/definitions/{key}/drilldown?row=&column= returns the ledger lines behind one cell (row is the row's _drill as the run returned it).
    • POST /reports/definitions/draft with text asks the assistant for a draft and its preview; nothing is saved.
    • MCP: draft_report_definition, save_report_definition, run_report, get_report_drilldown, list_report_templates and, for a firm, get_client_metrics.

    Reference: docs.alyabooks.ai.

    Still stuck? Contact support