I have a slice called ThisWeek that pulls from the data table all data that were entered during the current week. Since our week is Monday - Sunday, I had to do a little cajoling to get the appropriate data to show when a user is viewing the dashboard on a Sunday-
OR(
AND(WEEKDAY(TODAY())>1,
WEEKNUM(TODAY())=WEEKNUM([Date]),
YEAR(TODAY())=YEAR([Date])),
AND(WEEKDAY(TODAY())=1,
OR([Date]=TODAY(),
AND(WEEKNUM(TODAY())-1=WEEKNUM([Date]),
WEEKDAY([Date])>1)),
YEAR(TODAY())=YEAR([Date])
)
)
The first AND condition applies to viewing the dashboard on Mon-Sat and is pretty straight forward. The second AND condition is for viewing on Sunday. Basically, it says that if today is Sunday, allow data from today and from last week, as long as it’s not last week Sunday.
Two questions- is there any way to create a test environment to test different hypothetical dates? I made some adjustments to the formula just now and won’t be able to see if it works until it’s Sunday! In the spreadsheet version of this prototype, we had a cell that, when empty, all formulas would operate under today’s date, but when a test date was entered, all formulas would operate under the test date. Any way to replicate this in AppSheet?
Second question- I’m realizing the need to see a view of LAST week’s data, and ideally any past week’s data. I started creating a LastWeek slice, but then realized that my dashboard view has 6 other views, each with their own slices. I would need to copy all views and all slices and connect them to a LastWeek slice. Hoping for a better solution. Is there any way to create a slice such that any week (or at least last week) can be selected and viewed?