
1. Re: Total Number of Boolean Transitions
Alexander Mou Nov 2, 2015 5:03 PM (in response to Peter Harris)Peter, attach a sample workbook or dataset if you want an exact and quick answer.
Here is my idea of counting them.
1.Convert t/f into numbers
if 'T' then 1
else 0
end
2.Use the Quick Table calculations to calculate the difference from previous vlaue.
3.Sum up the absolute values: Sum(ABS(Difference))
This gives you the number of transitions.

2. Re: Total Number of Boolean Transitions
Peter Harris Nov 3, 2015 7:23 AM (in response to Alexander Mou)Thanks Alexander this is helpful
I have attached a workbook with some simplified data. The field Panel.Growth is the parameter that i am looking at. I would like to calculate the number of times that this field changes from T to F for each antibiotic with a simple calculated field so that i can use the calculated value in some other calculations later. Any ideas would be appreciated.
Thanks

Test Data.twbx 70.2 KB


3. Re: Total Number of Boolean Transitions
Alexander Mou Nov 3, 2015 12:14 PM (in response to Peter Harris)Here is the result. Let me know if you have questions
https://public.tableau.com/views/ChangeCount/Dashboard1?:embed=y&:display_count=yes&:showTabs=y

4. Re: Total Number of Boolean Transitions
Peter Harris Nov 3, 2015 12:52 PM (in response to Alexander Mou)Thanks again Alexander this was very helpful
Pete

5. Re: Total Number of Boolean Transitions
Alexander Mou Nov 3, 2015 1:11 PM (in response to Peter Harris)Sounds like this is not exactly what u expected .
On Tuesday, November 3, 2015, Peter Harris <

6. Re: Total Number of Boolean Transitions
Peter Harris Nov 3, 2015 1:28 PM (in response to Alexander Mou)Alex
Firstly, I appreciate the work that you have put in to this and your method definitely yields the correct number for total transitions between the two states. This is further than I was able to get and your code is more elegant than my solution. The problem that I am facing is that I need to use the calculated number as a variable in further calculations and this does not seem possible with the results of table calculations. The count of T/F transitions was an idea as to how we might achieve a more complicated filter, I may have to come up with another method.

7. Re: Total Number of Boolean Transitions
Alexander Mou Nov 3, 2015 1:32 PM (in response to Peter Harris)You got what you asked for.
Anything is possible with tableau.
On Tuesday, November 3, 2015, Peter Harris <

8. Re: Total Number of Boolean Transitions
Peter Harris Nov 3, 2015 1:34 PM (in response to Alexander Mou)You are correct…sometimes as a newbie to scripting in Tableau part of the issue is learning what question to ask
Thanks for your help