You can use an expression to calculate the Sunday of any
date's week:
dt+1 - Weekday(dt)
so you do not have to change the data in the table (might be
faster if you do??).
The T an P in my suggested query are both aliases for your
data table/query and are required because the query is
joining two copies of the same table/query (in the FROM
clause).
Using your field names and the date calculation above, the
query would be:
SELECT T.date, T.Element, T.Subs, T.[98th_w/DOCSIS],
P.SubsAs Psubs, P.[98th_w/DOCSIS] As Putil
FROM table As T INNER JOIN table As P
ON (T.date+1-WeekDay(T.date)) = (P.date+8-WeekDay(P.date))
And T.Element = P.Element
WHERE Abs(T.Subs- P.Subs) > .1 * P.Subs
OR Abs(T.[98th_w/DOCSIS] - P.[98th_w/DOCSIS])
> .1 * P.[98th_w/DOCSIS]
I still don't know the name of the query you posted so you
need to replace my use of "table" with the name you are
using.
thanks I can make them exactly one week apart
here is my exact layout i was unclear as to what the t.date and the
p.whatever meant I figured the t was my table
SELECT [US-DS].Date, [US-DS].Element, [US-DS].Subs, [US-DS].[98th_w/DOCSIS]
FROM [US-DS]
WITH OWNERACCESS OPTION;
:
Dave wrote:
I am trying to find all records where two fields have changed by 10 percent
year to date
I have weekly data of 40,000 unique names my table looks like this
date -element- subs- utilization
every element is time stamped with a date that changes once a week i want to
filter out and count the element field where the subs field and the
utilization field has changed by a 10 percent
If the dates for each element are exactly 7 days from one
to the next, then you can use something like:
SELECT T.date, T.element, T.subs, T.utilization,
P.subs As Psubs, P.utilization As Putil
FROM table As T INNER JOIN table As P
ON T.date = P.date+7
And T.element = P.element
WHERE Abs(T.subs - P.subs) > .1 * P.subs
OR Abs(T.utilization - P.utilization) > .1 * P.utilization