Counting day with events

Version 2

    Hello all, I am pretty new to Tableau and in need for help.

    I need to calculate how many times stock went lower than the Reorder point.

    If Reorder point > stock Available then “Out of Stock”

    “OUT OF STOCK” would be a calculated field

    I am able to calculate if the status is “OUT OF STOCK” or not.

    I am not able to calculate: If status stays “OUT OF STOCK” for up to 14 days (2 weeks) then count as 1 event. Like in the following example it would be considered 2 OUT OF STOCK events.

     

    Thanks you for your time and I will really appreciate any help.

    Raman

     

     

    Sample Data

    Date

    Material Name

    Stock Available

    Reorder point

    OUT OF STOCK(Y/N)

    8/11/2016

    A123

    150

    200

    Y

    8/12/2016

    A123

    150

    200

    Y

    8/15/2016

    A123

    150

    200

    Y

    8/16/2016

    A123

    150

    200

    Y

    8/17/2016

    A123

    300

    200

    N

    8/18/2016

    A123

    180

    200

    Y

    8/19/2016

    A123

    180

    200

    Y

    8/20/2016

    A123

    180

    200

    Y

    8/23/2016

    A123

    180

    200

    Y

    8/24/2016

    A123

    180

    200

    Y

    8/25/2016

    A123

    180

    200

    Y

    8/26/2016

    A123

    180

    200

    Y

    8/29/2016

    A123

    180

    200

    Y

    8/30/2016

    A123

    250

    200

    N