Skip to main content

Below is the data set I have - upto 10 columns. I am looking for occurrence of B consecutively 2 times.

 

For example in Col1, B occurred consecutively 4 times (Location 3-6) - I would count this as 2

 

And in Col2, B occurred consecutively 2 times (Location 7-8)- I would consider this as 1

 

At the end I would expect an output '3' .

 

I have around 10 columns which are categorized. I would like to count occurrence of a specific pattern for all the 10 columns. At the end I am expecting a single number as output Using a for loop this can be done quite easily in any programming language. I am looking for this single number instead of dragging Location to ROWS or Columns. Any suggestions would be very helpful.

6 answers
  1. Jul 15, 2021, 6:07 PM

    Hi @Bharadwaz S​ ,

    Ah, that's unfortunate! My only thought is to then do the same steps above per each column if you can't do outside of Tableau. And then simply add these together.

     

    But you are correct - to do this you need to have the grain be all of your locations. Tableau will not be able to do window functions without data being present in the view. You can, however, do this and then hide much of the data from your end users for a better aesthetic. I've done this with the LAST()=0 function after creating all of the necessary calculations:

    Hi @Bharadwaz S​ ,Ah, that's unfortunate! My only thought is to then do the same steps above per each column if you can't do outside of Tableau. And then simply add these together. 

    Best,

    Bryce

0/9000