Complete the code to create a trend line using Tableau's calculated field.
WINDOW_AVG([1])The WINDOW_AVG function calculates the average of the SUM of Sales over the window, which is commonly used for trend lines.
Complete the code to calculate the moving average for trend smoothing.
WINDOW_AVG(SUM([Sales]), [1], 0)
The moving average typically looks back one period, so the start offset is -1.
Fix the error in the calculated field to correctly compute the percent change over time.
([Sales] - LOOKUP([Sales], [1])) / LOOKUP([Sales], [1])
Using LOOKUP([Sales], -1) compares the current sales to the previous period for percent change.
Fill both blanks to create a calculated field that shows cumulative sales over time.
RUNNING_SUM([1]) OVER ([2])
RUNNING_SUM(SUM([Sales])) calculates cumulative sales, and ORDER BY [Date] ensures the sum accumulates over time.
Fill all three blanks to create a calculated field that calculates the slope of a trend line.
SLOPE([1], [2], [3])
The slope function requires the independent variable (Date), dependent variable (Sales), and a measure for weighting or context (Profit).