Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
santharubban
Creator III
Creator III

Weekly Calculation

Can anyone help in weekly calcualtion as below,


Week Starts Monday at 6:00 am and ends next Monday at 5:59am

5 Replies
swuehl
MVP
MVP

There is not much of information given here, but I assume you may want something like

LOAD *,

        Weekstart(Daystart(Timestamp, 0, 0.25),0, 0.25) as Weekstart,

        Weekday(Timestamp) as WeekDay;

LOAD Timestamp(RAND() + MakeDate(2015, 8)+floor(RAND()*31)) as Timestamp,

  RAND() * 100 as Value

autogenerate 1000;

Use Weekstart field to group your Timestamps in your given range, Mo 6:00 AM to next Mo 5:59 AM.

santharubban
Creator III
Creator III
Author

Thanks Swuehl..

I need to calculate work done for each week, but week are consider  monday 6.00am  to monday 5.59am.

swuehl
MVP
MVP

Understood.

Have you tried what I suggested above?

I assume your work done records show a related timestamp, so it should be easy to translate the above sample code to your setting (and if you find it hard to apply to your setting, why don't you post some sample lines of your data?).

santharubban
Creator III
Creator III
Author

can anyone help me in Weekly calculation,

if week starts on 8/24, then i need to calculate number of days for 8/24 6.00 am to 8/31 5.59 am. Pls find attached the highlighted records should not calculated for 8/24 week.

swuehl
MVP
MVP

Sure you can find help here, but it would make things a lot easier

- if you give feedback to the suggested solution (see my first post, haven't heard anything from you why this is not working)

- if you post a small sample data record set (like shown in your attached image, but not as image, but as e.g. INLINE table or Excel file)

Again, if you want to group your Date field values into ranges from Mon 6 AM to next Mon 5:59, something like

Weekstart(Daystart(Date, 0, 0.25),0, 0.25) as Weekstart,

in your load script or as calculated dimension should do the grouping.