I think the solution for you here is to reorganize your data to the following form:
ID Datetime Status1 Datetime Status0 A100 07.09.2017 15:31:10 07.09.2017 15:32:10 A200 07.09.2017 15:32:16 07.09.2017 15:42:19 B100 07.09.2017 16:42:21 07.09.2017 17:04:18 C400 08.09.2017 16:05:55 08.09.2017 16:35:57 C400(2) 08.09.2017 16:36:03 08.09.2017 16:37:00 D600 08.09.2017 17:49:06 08.09.2017 18:43:04
You will need unique rows to associate the Date times to each other for your DateDiff Calculation
Once this is done, you will simply use the Calculation DATEDIFF('Minute(or other desired time)', <Datetime Status1>, <Datetime Status0>)
I'm unsure how to get what you want with the way your data is set up.
How are you pulling your data? Do you have an ID column in your data source? there may be an easy way to change how the data is being pulled.
Hope this Helps.
today i get the data from a .csv file but in the futur i will connect straight to a sql.
i know i have to reorganize my data like in your example but how can i manage this?
today i have not a id column..
thx for your mind, this helps me a lot to understand how tableau and calculate fields works.
But i need the dataset like in bens recommadation. On this way its easier to build the viz.
But you said you don't have row ID?
not in the .csv file.. iam unsure if i will have a id column in the sql. :/
I'm going to assume you will have an ID column in SQL,
If the Data in SQL is set up in the same way as you have it in the .csv file, you will want to use the following Query as a blueprint for your CustomSQL query:
, Q1.DateTime as DateTimeStatus1
, Q2.DateTime as DateTimeStatus0
From (SELECT IDColumn, Var1, Var2, DateTime From <TableName> WHERE Status = 1) as Q1
LEFT JOIN (SELECT IDColumn, DateTime FROM <TableName> WHERE Status = 0) as Q2 on Q1.IDColumn = Q2.IDColumn
This should format your Data correctly for easy use.
Hope this helps