Calculated fields
Card calculated fields allow you to obtain results by combining one or more fields resulting from the queries made.

Basic calculated fields can be composed using basic arithmetic operators, such as addition (+), subtraction (-), multiplication (*), or division (/), between one or more fields.
Here are some examples:
  • Calculation of amount with VAT: metric_field * 1.21
  • Difference between two fields: metric_field1 - metric_field2
  • Application of a fixed margin to an amount: metric_field + 100
  • Calculation of a ratio between 2 fields: metric_field1 / metric_field2
Note that when including a field in a calculated field expression, it must be enclosed in curly braces { }. Following the previous examples, it would be {metric_field} * 1.21

It is often interesting to be able to have a comparison for a metric with respect to past periods. For example, if we are visualizing the amount of the sale monthly, and the business has a strong dependence on the calendar, we may be interested in comparing it with the amounts of the sale produced the previous year.
Biuwer includes a set of functions to compare a metric with previous periods, which you can use when composing card calculated fields:
  • PREV_YEAR: Compares the specified metric to the previous year.
  • PREV_QUARTER: Compares the specified metric to the previous quarter.
  • PREV_MONTH: Compares the specified metric to the previous month.
  • PREV_WEEK: Compares the specified metric to the previous week.
  • PREV_DAY: Compares the specified metric to the previous day.
All these functions are called in the same way, and always taking into account a date field as a reference to make the comparison.
The syntax is as follows, using a metric field and a date field as a time reference. Remember that when including the fields they must be enclosed in braces { }. We use PREV_YEAR as an example:
General syntax:
PREV_YEAR(metric_field, date_field)
A real example:
PREV_YEAR({f_sales_invoice.total_amount}, {f_sales_invoice.issue_date})
Comparisons with previous periods are very useful if they are configured correctly with the appropriate date levels, but may not be useful in other cases.
For example, if we configure a chart with a YEAR date level and configure a time comparison with respect to the previous DAY, the result obtained will not make much sense.
Copy link
On this page
Arithmetic operations
Comparisons with previous periods