Sam Idah
Sam Idah

Reputation: 1

Tableau - What would the LOD calculation be?

Pretty new to Stack overflow but hoping to get an answer to one of my project work

Region  Sales   Sales (LOD calculation only) 
West    100           0 
East    50           -50 
North   200          100

What would the LOD calculation be to get 0,-50 and 100 in column Sales (LOD calculation only)?

I do understand that row 2 and row 3 are both subtracted from first row. It's easy to do with Table calculation but i am unable to figure the LOD part out

Upvotes: 0

Views: 147

Answers (2)

Adrienne Tiley-Lerner
Adrienne Tiley-Lerner

Reputation: 11

To get sales like the one you displayed, to embed an if statement in an LOD calculation and subtract the initial sales from that number. You could write it as one big calc, but I'll break it down for simplicity.

  1. You'll need a way to assign the amount for the western region to every row. That calculation is

{EXCLUDE[Region]:SUM(IF [Region]='West' THEN [Amount] END)}

  1. Then you subtract the initial sales with a field like this SUM([Sales])-SUM({EXCLUDE[Region]:SUM(IF [Region]='West' THEN [Amount] END)})

Upvotes: 0

Pulkit Bansal
Pulkit Bansal

Reputation: 21

Welcome to Stack Overflow, i am also very new so hope i am helpful.

Looking at your requirement, i believe a LOD expression would not be valid for this. As you have mentioned you are already able to get your results using table calculations, which is the right approach for this type of problem.

LOD expressions are used when you need to do some aggregation in your data which is at a different grain then the selected dimensions.

Hope this helps.

Upvotes: 0

Related Questions