Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
stekol61
Creator
Creator

Count previous week

Hi!

I have a simple app where i want to count number of tickets for previous week.

However it doesn't work. Previous week is not correct and the count of tickets is for the whole period, not for prev week.

 

Year(Today())&'-'&Week(today()-7,'WW') as PreviosWeek

(Count( wor_ticket_ID))

stekol61_0-1614005455259.png

 

3 Replies
chrismarlow
Specialist II
Specialist II

Hi,

You probably want either an IF statement or a piece of set analysis on your count that either refers to the date that is associated with each ticket or to a calendar, depending on how complicated your previous week is to calculate.

What is the date field called?

Cheers,

Chris.

stekol61
Creator
Creator
Author

Hi!

Previous week is calculated as above:

Year(Today())&'-'&Week(today()-7,'WW') as PreviosWeek

chrismarlow
Specialist II
Specialist II

Hi,

I am not sure how that would handle first week of the year. When you say previous week, do you mean the last 7 days, or, the last set of seven days forming a week (so on a Monday to Sunday basis previous week is 15th-21st inclusive given today is 22nd, and would remain as that until next monday when this week becomes previous week).

But more fundamentally how do you know that a ticket is to be counted in the previous week? So I imagine it has a field something like 'TicketDate' or 'OrderDate' (or just 'Date') which you need to work out is in the previous week to then count wor_ticket_ID for those.

Cheers,

Chris.