Complete the code to calculate the difference between sales of the current and previous month.
SUM([Sales]) - LOOKUP(SUM([Sales]), [1])The LOOKUP function with offset -1 gets the previous month's sales, so subtracting it from current sales gives the difference.
Complete the code to calculate the percent difference between sales of the current and previous month.
(SUM([Sales]) - LOOKUP(SUM([Sales]), [1])) / ABS(LOOKUP(SUM([Sales]), [1]))
The offset -1 in LOOKUP gets the previous month's sales for comparison in percent difference calculation.
Fix the error in the calculation to correctly compute percent difference in sales.
(SUM([Sales]) - LOOKUP(SUM([Sales]), [1])) / LOOKUP(SUM([Sales]), [1])
The offset -1 is needed to refer to the previous month in the LOOKUP function for correct percent difference.
Fill both blanks to calculate the difference and percent difference between current and previous sales.
Difference: SUM([Sales]) - LOOKUP(SUM([Sales]), [1]) Percent Difference: (SUM([Sales]) - LOOKUP(SUM([Sales]), [2])) / ABS(LOOKUP(SUM([Sales]), [2]))
Both calculations require offset -1 to refer to previous month sales.
Fill all three blanks to create a calculated field that returns percent difference formatted as a percentage string.
ROUND(((SUM([Sales]) - LOOKUP(SUM([Sales]), [1])) / ABS(LOOKUP(SUM([Sales]), [2]))) * 100, [3]) + "%"
The offsets -1 get previous month sales; rounding to 1 decimal place formats the percent difference nicely.