5 Replies Latest reply on Oct 19, 2017 12:33 PM by Galen Busch

LOD calculation with Table calc throwing error

Hi,

I have a scenario where I have to get the total number of distinct customers in a particular bucket selected by user for a particular month-year.

bucket is defined by adding the running sum of sales for last 10 months  i.e. Running_sum is window_sum(sum(sales),-10,0). and then I take this "running_sum" to define by Bucket.

i.e. bucket: if [running-sum] < \$600, then 'A" elseif [running-sum] >= \$600 and  [running-sum] < \$1200 then "B" else "C".

at this moment I cant add LOD calculation to Bucket calculation(so that it puts a customer into certain bucket) as it throws error LOD calculation doesn't work with Table calc.

How do i implement this logic so I get distinct count of customers for particular bucket selected..?

• 1. Re: LOD calculation with Table calc throwing error

I might be wrong, but I don't see that possibility. Although you can use Running Sum with a previous calculated value using LOD but not LOD on Something created with Running_Sum.

• 2. Re: LOD calculation with Table calc throwing error

yes, thats correct. I just want to see if there any other way of doing this.. I dont know how to calculate previous 10 months without using table calc.

• 3. Re: LOD calculation with Table calc throwing error

Please attach a workbook with dummy data

• 4. Re: LOD calculation with Table calc throwing error

So that I understand you correctly - you want the distinct count of all customers that have made a purchase in the 10 months leading up to each month. January could have 1000 customers, February could have 850 customers, etc. where average customers per month would be something like 150.

Personally, I would approach this in SQL first. LOD calculations are great until you run in to table calculations. The reason for this is pretty simple - table calculations are computed as a last step in Tableau, where LOD calculations are completed first, and could not reference a table calculation that is computed later.

• 5. Re: LOD calculation with Table calc throwing error

The LOD fails because it references your buckets which references a table calculation. If a table calculation is a dependency of any calculation nested under an LOD, it will fail.

Tableau executes:

1. The LOD calculation

2. The table calculation

2. The bucket calculation (conditional logic computed with the table calculation)

... and it has to work this way.

the table calculation being computed last can't be referenced by something computed higher up in order of operation.