Functions
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