Functions
If you've chosen EU number format, all commas should be replaced by semicolon.
Example:
US format: sum_last("Revenue", 12)
EU format: sum_last("Revenue"; 12)
sum("row_name"[range_start : range_end])
The sum()
function calculates the total of the values in the specified time series from range_start
to range_end
.
Example: sum("Revenue"[-3:0])
sum_ytd("row_name")
The sum_ytd()
function returns the sum of the values in a time series from the beginning of the fiscal year until and including the current month.
Example: sum_ytd("Revenue")
sum_last_year("row_name")
The sum_last_year()
function returns the sum of the values in the previous fiscal year. This function is influenced by your fiscal year settings.
Example: sum_last_year("Revenue")
sum_last("row_name", num_months)
The sum_last()
function returns the sum of the values in the time series going back X months, as defined by the months parameter.
Example: sum_last("Revenue", 6)
avg("row_name"[range_start : range_end])
The avg()
function calculates the average of the values in the specified time series from range_start
to range_end
.
Example: avg("Revenue"[-3:0])
avg_ytd("row_name")
The avg_ytd()
function returns the average of the values in a time series from the beginning of the fiscal year until and including the current month.
Example: avg_ytd("Revenue")
avg_last_year("row_name")
The avg_last_year()
function returns the average of the values in the previous fiscal year. This function is influenced by your fiscal year settings.
Example: avg_last_year("Revenue")
avg_last("row_name", num_months)
The avg_last()
function returns the average of the values in the time series going back X months, as defined by the months parameter.
Example: avg_last("Revenue", 6)
ignore_div_zero(a/b)
Theignore_div_zero()
returns a zero if the function's output is a #DIV!/0 error. The function is used for margin and percentage calculations, where the denominator is occasionally zero.
power(num, exponent)
The power()
function is a mathematical function that returns the value of the parameter num to the power of the exponent parameter.
Example: power(10, 2)
returns 100
round(num, [decimals])
The round()
function rounds the number value up or down to the nearest integer. Optionally, provide desired number of decimals.
if(condition, value_if_true, value_if_false)
The if()
function allows you to create a conditional calculation, similar to what is available in Excel or Google Sheets.
if(condition, value_if_true, value_if_false)
Example to calculate gross profit margin:
if("Revenue"[0]=0,0,"Gross profit"[0]/"Revenue"[0])
If revenue is zero, display zero; otherwise, calculate the gross profit margin. This specific example prevents #ERRs from dividing by zero.
if_month(a, b)
The if_month
function returns 1
if the time period is equal to the month number input in the formula, else 0
.
if_month(1) will return
1
if the month is January, else0
if_month(1, 6) will return
1
if the month is January or June, else0
if_quarter_month(num)
The if_quarter_month
function returns 1
if the time period is equal to the month number inside a given quarter. E.g., you can input [1;3] into the formula.
if_quarter_month(1)
returns1
if the month is Jan, Apr, Jul, or Octif_quarter_month(2)
returns1
if the month is Feb, May, Aug, or Novif_quarter_month(3)
returns1
if the month is Mar, Jun, Sep, or Dec
Last updated