5 Replies Latest reply on Sep 14, 2016 9:40 AM by Kyle Boyce

# Slope of a measure?

I want to be able to conditionally color a metric based on whether the slope of that metric (the metric being compared week by week over 13 weeks) is positive or negative? Thanks.

• ###### 1. Re: Slope of a measure?

Please attach a Tableau Packaged Workbook including sample data.

• ###### 2. Re: Slope of a measure?

slope is defined as change in Y over change in X. so use your calculated field to determine first if you slope is or . Once you have that calculated field with results ranging from , 0, or create another calculated field that says

IF [slope] > 0 THEN "Positive"

ELSEIF [slope] <0 THEN "Negative"

ELSEIF[slope] = 0 THEN "0"

END

Drag this calc field onto the color shelf and pick you colors.

• ###### 3. Re: Slope of a measure?

yes but is there a formula that will compute slope over a given date range

• ###### 4. Re: Slope of a measure?

Check this thread out: Re: Trend line slope (and p-value)

• ###### 5. Re: Slope of a measure?

Is it a line with two endpoints or multiple ups and downs (from day to next day?) if the latter you could always use a LOOKUP function to look back in the viz one and see if the value is more or less than the current. if you only have one line (two points) you could use a difference between WINDOW_MAX and WINDOW_MIN.