lundi 5 mars 2018

SQL Numeric/Date Pattern Analytics/Timespans

I'm building an product based on weekday analytics. Essentially, data will be populating into a table on various days of the week for different products, and I'm trying to see if the data population date follows a specific pattern, and if so, I'd like COUNT the number of consecutive days in this pattern.

For example:

Product ABCD, over the last six months, has had data populated on Monday, Wednesday, and Friday, each week (weekdays 2, 4, and 6).

I'd like to know, how many consecutive days (Mondays, Wednesdays, and Fridays) the data has been populated. For example, if over the last 4 weeks, we have had an update on every Mon, Wed, and Fri, the number of consecutive 'days' would be 12 (three days each week * 4).

For the weekday data (matching each product to the weekday numbers with entries), I've shaped the data like this (if scripts are needed, I can send too, however, most of my data is still raw so I need help shaping it):

WeekDay Analytics of Data

Aucun commentaire:

Enregistrer un commentaire