Calculating date formulas is useful when you want to compare data from different date periods.
Here are some examples of using date formulas:
The following example shows you how to create formulas that you can use to compare data from this week to last week.
- The formula for this week is week ( today () ) - week (date).
- The formula for last week is diff_days ( week ( today ) ) , week ( date ) ).
The following example shows you how to calculate the percent increase from the last date period to this period in terms of revenue.
- Create the formula, this week revenue = sum ( if ( this week ) then revenue else 0 ).
- Then create the formula, last week revenue = sum ( if (last week ) then revenue else 0 ).
- Now you can use nested formulas to calculate the percent increase by creating a parent formula, percent increase = ( ( last week revenue - this week revenue) / last week revenue ) * 100.