Arithmetic Operations

Predefined metrics can be manipulated with any basic arithmetic operation: addition (+), subtraction (-), multiplication (*), and division (/).

By using numerical variables, you can also add dynamic values into your arithmetic operations.


Adding, Subtracting, Multiplying, and Dividing

Add, subtract, multiply, or divide predefined metrics.


SELECT metric1 + metric2
SELECT metric1 - metric2
SELECT metric1 * metric2
SELECT metric1 / metric2


SELECT Expenses + Salary
SELECT Revenues - Costs
SELECT Profit * 0.03
SELECT New_Revenue / Revenue_Last_Year 

where Expenses, Salary, Revenues, Costs, Profit, New_Revenue, and Revenue_Last_Year are predefined metrics.

Numerical Variables

MAQL allows you to introduce dynamic values into arithmetic operations by using numerical variables with user-specific dynamic values in arithmetic expressions.

Workspace administrators can assign numerical variables to specific project members in the Manage section of the GoodData Portal.


SELECT metric1 * variable


The following example shows how to calculate user's sales commissions using a numerical variable.

SELECT Amount_Won * commission_rate_variable 
Powered by Atlassian Confluence and Scroll Viewport.