12 Replies Latest reply on Dec 7, 2018 7:56 AM by Chadi Atie

# How to calculate the Difference from 1 dimension and 1 measure?

Hello Guys,

I have a dimension called Type where I only have two values: A - B

I have a measure called Amount

What I need to do is calculate the difference of values between B and A, in other words:

Difference = (Amount When Type = B) - (Amount When Type = A)

How could I do this in Tableau?

Thanks a lot for your help,

• ###### 1. Re: How to calculate the Difference from 1 dimension and 1 measure?

Good morning

One way is with LOD's

here is a superstore example

you can add dimensions before the colon if you need to take into account other breakouts

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• ###### 2. Re: How to calculate the Difference from 1 dimension and 1 measure?

Hello Jim,

I did exactly the same thing, but it didn't work.

It is giving me only blank.

Any ideas?

1 of 1 people found this helpful
• ###### 3. Re: How to calculate the Difference from 1 dimension and 1 measure?

the usual cause are Nulls in the data

Jim

1 of 1 people found this helpful
• ###### 4. Re: How to calculate the Difference from 1 dimension and 1 measure?

Can it be solved if I have Nulls in the data?

I am not sure I can upload because I have some confidential data

Thanks a lot

1 of 1 people found this helpful
• ###### 5. Re: How to calculate the Difference from 1 dimension and 1 measure?

1 of 1 people found this helpful
• ###### 6. Re: How to calculate the Difference from 1 dimension and 1 measure?

Hello again Jim,

Here you go, I have attached the packaged workbook.

Thanks a lot

1 of 1 people found this helpful
• ###### 7. Re: How to calculate the Difference from 1 dimension and 1 measure?

see the attached

sorry I thought you were counting records - not summing amounts - and also there are nulls in the data and yoiu want the results by project

returns this

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• ###### 8. Re: How to calculate the Difference from 1 dimension and 1 measure?

I don't know why it is working with the file that I have sent you. But NOT with my original file.

I have sent you the exact same dataset without the other columns. Didn't change anything.

What could be the issue?

1 of 1 people found this helpful
• ###### 9. Re: How to calculate the Difference from 1 dimension and 1 measure?

are you using more than one dataset?

LODs require that all the values (dimensions and measures) come from the same data set

1 of 1 people found this helpful
• ###### 10. Re: How to calculate the Difference from 1 dimension and 1 measure?

Nope, I am just using one dataset (.csv)

Same one that I have sent without the other columns.

1 of 1 people found this helpful
• ###### 11. Re: How to calculate the Difference from 1 dimension and 1 measure?

copy off a few lines of the data and send it in a csv file - only a few that include the values in the dimension

1 of 1 people found this helpful
• ###### 12. Re: How to calculate the Difference from 1 dimension and 1 measure?

Found it, thanks

1 of 1 people found this helpful