Reputation: 1
I am new here but hoping that I can get some better answers than on the Tableau community.
I am working to create a calculator tool within Tableau. It is a bit of a strange thing to do within Tableau but so far it is working well until I came across this problem.
I want to calculate a tax asset value available for each year and applied (or used) for each year then calculate the remaining value and carry it forward to the next year.
The calculation is: (best seen in the Tableau image)
Added tax deduction (D)=
IF EBITDA**(A)**<0 then EBITDA (A) * - 1 + Depreciation (B)
ELSE Depreciation (B)
Opening Balance (C) = lookup CF Tax Deduction (G),-1
Available Tax deduction (E)=
Opening Balance (OB tax) (C)+ Added Tax Deduction (D)
Used Tax Deduction (F)=
IF EBITDA (A)>0 then min(Available Tax Deduction (E), EBITDA (A)) //-this is because you cannot deduct more tax than your income
Carryforward (CF Tax Deduction) (G)=
Available Tax Deduction (E) - Used Tax Deduction (F)
The calculation works in excel but creates a circular reference in Tableau.
Anyone have suggestions as to how to avoid the circular reference? As soon as I enter in the formula for Used Tax Deduction I get a circular reference. I am now trying to solve using tabpy/python as well.
Upvotes: 0
Views: 259
Reputation: 11
Lookup cannot handle recursiveness that you implicitly entered through the circular reference of G(t) to G(t-1). (Where G(t) means the carryforward of the current time period, and G(t-1) is the same of the previous period.) If I simplify a bit the above calculations, this is what I get: G(t) = E(t) - F(t) Then replacing E(t) gives: G(t) = C(t) + D(t) - F(t) Where C(t) is effectively G(t-1), therefore: G(t) = G(t-1) + D(t) - F(t)
Tableau's recommended solution for such recursive formulae is the PREVIOUS_VALUE(). Try to implement this G(t) = PREVIOUS_VALUE(0) + D(t) - F(t) or simply put: G = PREVIOUS_VALUE(0) + D - F (PREVIOUS_VALUE(0) starts with zero value in the first round of the calculations.)
Upvotes: 0