1 Reply Latest reply on Sep 29, 2016 10:07 AM by Shinichiro Murakami

# Tableau Calculations

Hi Folks,

I am trying to calculate sum(X) since my last event.

Here is the data

ProductName      part id      date                event               Sum

a                              1           X                         0                    10

a                              1           X1                         1                    10

a                              1           X2                       0                    10

a                              1           X3                         0                    10

a                              1           X4                         0                    10

a                              1           X5                         1                    10

a                              1           X6                         0                    10

a                              1           X7                         0                    10

a                              1           X8                         1                    10

a                              1           X9                         0                    10

a                              1           X11                         0                    10

a                              1           X12                         0                    10

a                              1           X13                        0                    10

a                              2           X                         0                    10

a                              2           X1                         1                    10

a                              2           X2                       0                    10

a                              2           X3                         0                    10

a                              2           X4                         0                    10

a                              2           X5                         1                    10

a                              2           X6                         0                    10

a                              2           X7                         1                    10

a                              2           X8                         0                    10

a                              2           X9                         0                    10

a                              2           X11                         1                    10

a                              2           X12                         0                    10

a                              2           X13                        0                    10

I am trying to calculate SUM since my last event

Expected result

ProductName               part id               date                                   event               SUM-Sincelast event

a                                        1                    X8(last event date)               1                         40 (excluding event day sum)

a                                        2                      X11                                          1                         20

similarly i have different products

Any suggestions?

• ###### 1. Re: Tableau Calculations

Ravite,

I needed to change X~X13 to X00 to X13 to make it sorted correctly.

Anyways, see below.

[Sum after latest Event]

sum(if [Date Sequential]>[max Date] then [Sum] end)

[max Date]

{fixed [Part Id]:max(if [Event]=1 then [Date Sequential] end)}

[Event Name]

{fixed [Part Id]:min(if [Date Sequential]=[max Date]then [Event]end)}

Thanks,

Shin