Omniscope Custom Blocks › Preparation/Multi-Field-Formula

Multi-Field Formula

Applies one operation (round, scale, share of row or column total, index to base, z-score, fill, text case...) to many fields chosen by list, name pattern or type, with optional row statistics.

Preparation › Formula Python visokio-agents

Open the demo in Omniscope Download demo.ioz Sample data: monthly-budget.csv Source on GitHub

Items tagged visokio-agents are community examples built by Visokio's agents, to extend Omniscope's core blocks and views with popular, specialist and more unusual use cases, and to show what anyone, people or agents, can build on Omniscope. They are tested by automated tests and were run on a real Omniscope server. They were not reviewed by Omniscope's core team, so they are not on a par with the core blocks and views, which have years of manual, functional and unit tests behind them. About

Omniscope custom block · Preparation

One operation, many fields: shares of row total, indexes, rounding, scaling, filling and text clean-up across every month column (or any set of fields) in one step.

Python · pandas, numpy · nothing extra to install

The problem it solves

Wide tables are everywhere in finance and planning: one column per month, per scenario, per store. Applying the same calculation to every column, such as each month's share of the year, an index to January, rounding or filling blanks, means a formula per column, and new columns next month mean editing the workflow again.

Multi-Field Formula applies one operation to every selected field, chosen by name pattern so new columns are included automatically, and can add row totals and other row statistics.

How it works

What goes in

Monthly budget, one column per month

Six departments x 12 months (6 shown), synthetic. HR has a blank for August.

Department Cost Centre Jan 2025 Feb 2025 Mar 2025 Apr 2025 May 2025 Jun 2025
Marketing CC-852 40682.67 45868.29 43388.66 58139.94 55086.36 47341.2
Sales CC-335 61910.63 74777.67 78205.65 83866.24 76869.75 75293.81
Operations CC-915 134808.26 121172.06 130172.92 136388.15 154714.67 139019.58
Technology CC-930 82035.1 96052.98 108064.92 121828.31 103050.61 94616.51
HR CC-569 19212.48 23733.69 27271.83 26375.25 27319.78 27582.05
Finance CC-731 29810.53 34905.66 33987.84 34040.71 31442.85 36968.97

6 rows in the sample file.

The options

Option Demo setting What it does
Field name pattern (regular expression) 2025$ Adds every field whose name matches, for example 2025$ for all 2025 columns.
Operation Share of row total What to do to every chosen field.
Results Add new fields Overwrite the fields, or add new ones next to them.
Suffix for new fields share Added to the name of each new field.
Row sum On Adds the total of the chosen fields for each row.

What comes out

Output (first three months and their shares)

Department Jan 2025 Feb 2025 Mar 2025 Jan 2025 share Feb 2025 share Mar 2025 share Row Sum
Marketing 40,682.67 45,868.29 43,388.66 0.08 0.091 0.086 1
Sales 61,910.63 74,777.67 78,205.65 0.079 0.096 0.1 1
Operations 134,808.26 121,172.06 130,172.92 0.093 0.084 0.09 1
Technology 82,035.10 96,052.98 108,064.92 0.078 0.091 0.102 1
HR 19,212.48 23,733.69 27,271.83 0.08 0.099 0.114 1
Finance 29,810.53 34,905.66 33,987.84 0.084 0.098 0.095 1
The new share fields as a heat map: the seasonal phasing of each department's budget (synthetic data).
The new share fields as a heat map: the seasonal phasing of each department's budget (synthetic data).

The new share fields as a heat map: the seasonal phasing of each department's budget (synthetic data).

The same block with Index to base field: each month relative to January.
The same block with Index to base field: each month relative to January.

The same block with Index to base field: each month relative to January.

Where it pays off

Finance: Budget phasing and variance packs

Shares of the annual total per month, indexes to the first month or to budget, and rounding for presentation, across every month column.

Retail: Store-by-week tables

Normalise weekly sales columns per store to shares or indexes to compare stores of different sizes.

Data science: Feature preparation

Z-score, min-max scale or log-transform dozens of numeric features before clustering or modelling.

Data management: Bulk clean-up

Trim, upper-case or fill blanks in every text field of an imported table in one step.

Use cases describe typical scenarios and are illustrative.

Why do this in Omniscope

How it fits into an Omniscope workflow

Budget (Excel) → Multi-Field Formula → Multi-Field Formula → Report

Chain blocks for several operations (fill blanks with 0, then share of row total). Use the name pattern so next year's columns work without changes.

For long data (one row per month), Omniscope's Aggregate and Field organiser formulas are often simpler; this block is for the wide case.

It applies one operation across the fields that match a name pattern, so when next year's budget columns arrive the workflow and the Report carry on without edits, and it can be opened and adapted from its source.

In one step

The common multi-field operations as a pick list, with dynamic field selection by name pattern. Omniscope's Bulk field organiser covers renaming and types.

Try it

  1. Open the demo project (demo.iox on the demo server, or import demo.ioz from this folder): a budget with one column per month.
  2. The question: what share of each department's annual budget falls in each month? Twelve formulas, or one block.
  3. Open Multi-Field Formula: name pattern 2025$, share of row total, add new fields, row sum. Run it.
  4. Look at the twelve new share fields and the heat map. Switch to Index to base field (January) for the trend view.
  5. Next year's columns are picked up by changing the pattern, not the workflow.

Running in Omniscope

Omniscope workflow
Omniscope workflow

The demo project's workflow: the sample data, the block, and a Validate data check on its output.

Language and libraries

Python. It uses pandas and numpy, plus the Python standard library (re).

pandas and numpy are part of Omniscope's Docker Python image, and the block was run in both host mode and Docker mode on an Omniscope server, with the same results. It needs nothing else installed.

Tested

The demo workflow runs without errors on an Omniscope server and produces 6 records in Result. Its automated tests cover normal data, empty input, wrong types and large input.

Reference

Fields it reads

NameTypeWhat it does
FieldsFieldsLeave empty to use a name pattern or all fields.
Base field (index / difference)Field

Options

NameTypeWhat it does
Field name pattern (regular expression)TextAdds every field whose name matches, for example 2025$ for all 2025 columns.
Only fields of typeChoice
OperationChoiceWhat to do to every chosen field.
ValueNumberFor multiply, divide, add, subtract, floor, cap and fill.
Decimal places (round)Whole number
Text (prefix, suffix, fill)Text
ResultsChoiceOverwrite the fields, or add new ones next to them.
Suffix for new fieldsTextAdded to the name of each new field.
Row sumYes / noAdds the total of the chosen fields for each row.
Row meanYes / no
Row minimumYes / no
Row maximumYes / no
Row count of valuesYes / no
Row standard deviationYes / no

Outputs

OutputWhat it holds
ResultThe input with the operation applied (or new fields added) and any row statistics.