7 Replies Latest reply on Jul 10, 2018 10:24 AM by swaroop.gantela

# Slope, Intercept, x, y, a in a table as per dimension selected

Hi

I am trying to calculate a slope for two measures in Tableau Version 10.5.

I want to display the slope in a table as per dimension selected. I am unable to get a slope on a detail and summary level. I am attaching a tableau workbook that I used from forums to demonstrate the problem

In am trying to get a sales figure for a profit by year and customer segment. I am not getting same value in the scatter plot and table, i guess because the table calculation is different. Is there any way to get similar value on summary level without the order id?

I am calculating x value with y and a values

Any help would be much appreciated

Thanks

Priti

• ###### 1. Re: Slope, Intercept, x, y, a in a table as per dimension selected

Priti,

I'm not sure if I fully caught the gist, but please see the workbook attached in the Forum Thread is closer to the goal.

You can add Order ID to your table sheet,

then set the Compute Using to all Dimensions,

restarting every [Customer Segment].

This should give your the correct values for the slopes,

but will place a repeated copy of the value for every OrderID.

You can then create a calculated field of Index() and place that

on the Filter shelf, and just filter it down from one to one.

This has been done on Sheet 3 of the attached.

• ###### 2. Re: Slope, Intercept, x, y, a in a table as per dimension selected

Awesome Swaroop

This is exactly I was looking for Thank you so much

Just an extension to this, I need to sort the table on Sales@Profit field in descending order and show the difference from the highest value

like diff = 42,630-30,680 for corporate, 42,630-33,143 for Home Office and 142,630-31,196 for Small Business

I don't see this calculated field in custom sort option

• ###### 3. Re: Slope, Intercept, x, y, a in a table as per dimension selected

Priti,

Another method to sort is to make the field in question

discrete, and then place it on the Rows shelf to the left

In this case, you can try dragging Sales@Profit to the Rows shelf,

right-click and "Edit in shelf", place a negative sign in front of it

(to get it to sort in descending order), make it discrete,

then move it to the left of Customer Segment. If the order looks right,

you can then unclick Show Header for the -[Sales@Profit].

To get the diff from max you can use:

WINDOW_MAX([Sales@Profit]) - [Sales@Profit]

where the table calculation settings are the same as before,

but now you would restart every Year of Order Date.

Please see workbook attached in the Forum Thread.

1 of 1 people found this helpful
• ###### 4. Re: Slope, Intercept, x, y, a in a table as per dimension selected

Great Its working. Thanks a lot Swaroop

I am unable to download the tableau file though

• ###### 5. Re: Slope, Intercept, x, y, a in a table as per dimension selected

Priti,

Apologies about that, and for delay.

Please try the attached.

1 of 1 people found this helpful
• ###### 6. Re: Slope, Intercept, x, y, a in a table as per dimension selected

Superb Swaroop

Got the table calculation clue from the attached tableau file and its all working now. Thanks you so much

• ###### 7. Re: Slope, Intercept, x, y, a in a table as per dimension selected

Priti,

Glad it worked for you.

All the best.