3 Replies Latest reply on Oct 13, 2018 3:11 AM by Jim Dehner

# Table calculation to measure when an attribute changes from the last instance

Hi, all. Hopefully someone knows a way to do this for a data set that has tens of millions of records. I need to create a measure that will increase in count when a customer's status changes from the last instance. For example, in the data set below, customer_id A changes in status on 2/1/18, so I would want this table calc to return a 1 for this for the month of February, based on the last instance (in January) having a different status. I'm trying to measure status changes, not changes to a specific value. So whether the status changes to 1 or 0 is irrelevant. I need to count when status is different from the last instance for that customer_id.

customer_idstatusdate
A11/1/18
B01/2/18
A02/1/18

Crossing fingers for some Tableau guru to have the answer.

Thanks!

Edit: I don't think it would make a difference, but my actual status field is text, not numbers.

• ###### 1. Re: Table calculation to measure when an attribute changes from the last instance

Hi

the formula below

will produce this - note how the table calc is set up

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.

• ###### 2. Re: Table calculation to measure when an attribute changes from the last instance

Hi, Jim. Thanks, but that didn't work for me. Though my table has 1s and 0s, I edited the thread to indicate my status values are text values, like "active," "inactive" etc. And I am trying to make a bar chart showing the count of status changes over time. Hopefully your calc just needs a tweak.

• ###### 3. Re: Table calculation to measure when an attribute changes from the last instance

sew the attached -

all I added was a running sum of the change indicator

this will find the changes - makes no difference if you use 1 and 0 active inactive - the expression in words says if the status value of this record is not the same as the preceding record then 1 else 0

it is calculated as

this will sum the indicators

it is set up the same way

and it will return this with your initial data

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.