Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

I am struggling to get formulas correct.

Ask.PNG

Good Day ,

Please help
I need the Average for the last 2 Previous Sundays Always then Subtract with the latest Sunday   
I need the Average for the last 2 Previous Mondays Always then Subtract with the latest Monday   
Please Note My Job DOES NOT RUN on Saturday
Tuesday  to Friday I just add the figures   
   
From the Database I get the following fields Job Name , Minutes and Run Start Date 
However, the chart isn't fixed to only the last two weeks, so the function would have to be able to call on any given Day

Thanks in advanced for your assistance

1 Reply
jyothish8807
Master II
Master II

Hi,

Try this:

A:
LOAD * INLINE [
JobID, Min, Date, Day
A, 91.44813198, 9/9/2018, Sunday
B, 45.60773901, 9/10/2018, Monday
C, 12.00850952, 9/11/2018, Tuesday
D, 60.91871591, 9/12/2018, Wednesday
E, 5.435460199, 9/13/2018, Thursday
F, 47.61795408, 9/14/2018, Friday
H, 37.26414158, 9/16/2018, Sunday
I, 30.42634625, 9/17/2018, Monday
J, 68.5652672, 9/18/2018, Tuesday
K, 2.384506152, 9/19/2018, Wednesday
L, 95.97960818, 9/20/2018, Thursday
M, 62.36853024, 9/21/2018, Friday
O, 66.91725313, 9/23/2018, Sunday
];
NoConcatenate
B:

Load *,
If(Month_Name=Previous(Month_Name) and Day=Previous(Day),peek(New)+1,1) as New;
Load
JobID,
ceil(Min) as Min,
Date(Date,'MM/DD/YYYY') as Date,
MonthName(Date) as Month_Name,
Day
Resident A
order by Day,Date;

Drop table A;

Best Regards,
KC