Current week and Last week

Hello guys !

Can someone help me please ? I want to create two slices :

  1. A slice who show the records of current week
  2. A slice who show the records of last week

How can I do that ? Do you have an expression for that ?

Thank you.

Solved Solved
0 8 1,676
1 ACCEPTED SOLUTION

Please try

  • A slice who show the records of current week -

WEEKNUM([Date Column])= WEEKNUM(TODAY())

  • A slice who show the records of last week -

WEEKNUM([Date Column])= WEEKNUM( (EOWEEK(TODAY()) - 7) )

AppSheet’s week is from Sunday to Saturday in all WEEK expressions.

Edit: made a change in second expression

View solution in original post

8 REPLIES 8

Please try

  • A slice who show the records of current week -

WEEKNUM([Date Column])= WEEKNUM(TODAY())

  • A slice who show the records of last week -

WEEKNUM([Date Column])= WEEKNUM( (EOWEEK(TODAY()) - 7) )

AppSheet’s week is from Sunday to Saturday in all WEEK expressions.

Edit: made a change in second expression

Thank’s @Suvrutt_Gurjar for your answer, I’m going to try it right now !

It works perfectly, thank you @Suvrutt_Gurjar

You are welcome. Please do test well for weekends during the year end when the year flips but the weeks remain same,

Alright. I’ll be careful and make an adaptation just in case. Thank you

One expression shorter EOWEEK([Date Column])=EOWEEK(TODAY() - 7). If you use dates more than from one year, the WEEKNUM() doesn’t work correctly.

Supporting what @Aleksi has mentioned, you can get the correct WEEKNUM with below expression:

FLOOR(
	(10 +
	IF(
		MOD(YEAR([TIMESTAMP]), 4) = 0,
		INDEX({0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335},MONTH([TIMESTAMP])),
		INDEX({0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},MONTH([TIMESTAMP]))
	) + DAY([TIMESTAMP]) - (WEEKDAY([TIMESTAMP]) - 1)) / 7
)

so monday to sunday week is behind tricks only??

Top Labels in this Space