I need to schedule reports on monthly basis. The reports need to go out on 1st of each month with data from previous month. For reporting, I have selected the preset date option as 'Last Month' with monthly rolling date option. Right now, it says: Rolling date options: 04/01/2017 (rolling monthly) - 04/30/2017 (rolling monthly) which is how it should be. But I am concerned if it considers the varying number of days in a month (30, 31). Can someone confirm when the next set of reports go out on 6/1, whether the date range would be from 05/01/2017 to 05/30/2017 or 05/31/2017?
If it doesn't consider the number of days in a month, is there an alternative to this setup for achieving the same results?
"Rolling monthly" does just as the name implies. When the date shifts from 4/30 to 5/1, the report will update to April data. When the date shifts from 5/31 to 6/1, the report will update to May data. If on 6/15 you again open the report, it will still be populated with May data, because the month has not yet rolled.
Related
I have a sheet with the date of an initial assessment. A review for each assessment needs to be done every 90 days.
This is what the table looks like:
Initial
Last Review
Next Review
5/5/22
8/3/22
In the second column, the last review will be entered so the next review will also update. However, the review date is based on the initial assessment, not the date of the review. So if the review is done early or late, the next review date will still be based on the initial assessment.
This is what the table should look like
Initial
Last Review
Next Review
5/5/22
6/12/22
11/1/22
For now I am using this IFS formula in the third column that looks at the second column and updates the date for the next review:
=IFS(B1="",A1+90,(B1>=A1+0)*(B1<=A1+90),A1+180,(B1>=A1+90)*(B1<=A1+180),A1+270,(B1>=A1+180)*(B1<=A1+270),A1+360,(B1>=A1+270)*(B1<=A1+360),A1+450,(B1>=A1+360)*(B1<=A1+450),A1+540,(B1>=A1+450)*(B1<=A1+540),A1+630)
This works perfectly fine, but some reviews can potentially be more than 630 days later. Is there a way to shorten this formula, or will need to keep adding more and more to calculate the dates past 630 days?
Edit: So I had a realization after messing around with some of the dates and the answers provided. If the review is done late, the formula will skip a review date.
Using the example I included, if the first review is done on 8/6/22, then the next review will be shown as 1/30/23 instead of 11/1/22.
From the answers provided #Martin 's answer =IF(B1="",A1+90,A1+(1+ROUNDUP((B1-A1+1)/90))*90 works perfectly if the review is done early or on time. #Arav 's answer =IF(B1="",A1+90,B1+90-MOD(B1-A1,90)) will only work if the review is late.
You can try with ROUNDUP:
=IF(B1="",A1+90,A1+(1+ROUNDUP((B1-A1+1)/90))*90
That will calculate the amount of 90 days passed and round up to the next one 90s
UPDATE
I think that the only case in which a date would change the calculations is when it's done early. Meaning, as you stated in your comments, 14 days before the next revision. Considering that, the formula would be with those 14 days summing:
=IF(B1="",A1+90,A1+(+ROUNDUP((B1-A1+14)/90))*90)
What should you do if the date is more than 30 days later?? If it's late, the date of the next revision shouldn't stay but keep in the next multiple of 90 days lapse. What you can do is to use some conditional formatting, for example:
=(MOD((B1-A1),90)>30)*(MOD((B1-A1),90)<76)
That considers the dates going from more than 30 days to less than 76 (because then it would be an early review of the next date)
See this conditional formatting operating in this example, in which I mapped 5 days lapse to see how the dates are changing. As you can see, the orange is for the out-of-date revisions with the previous conditional formatting; and in green I marked the places where the dates change:
Let me know!
The formula you've provided is checking for specific ranges of days between the initial assessment and the last review, and then returning the next review date based on those ranges. It's a bit long and can be hard to read.
To shorten the formula and make it more flexible for future assessments, you could use the MOD function to check if the number of days between the initial assessment and the last review is a multiple of 90. If it is, the next review date would be 90 days after the last review. If not, you could add the remainder of days to 90 to get the next review date.
Here's an example of what that formula might look like:
=IF(B1="",A1+90,B1+90-MOD(B1-A1,90))
This formula checks if the last review is empty, if yes it returns the date of initial assessment plus 90 days, otherwise it returns the date of last review plus 90 days minus the remainder when last review date minus initial assessment date is divided by 90. This way, it will always give you the next review date after 90 days of the last review date, regardless of how many days past the last review date is.
I manage digital marketing campaigns from end-to-end, and there are various steps within each campaign's production process that are due certain dates out from and relative to a final launch date, which may be subject to change.
In Google Sheets, I would like to be able to input a launch date and have each step leading up to it display its due date a specific amount of weekdays out from the launch date. If the launch date changes, I would like all the dates in the steps that come before it to change dynamically/automatically with it.
e.g. The launch date is 23-12-2019, but the last step in the process is due one weekday before the launch date, so it must display 20-12-2019; the second last step is due 3 weekdays before the launch date, so it must display 18-12-2019, and so on...
This was once possible in a former role where I used Excel, but I am at a loss for how to set this in Google Sheets. I would then like to set conditional formatting so that if the due date per step arrives, that it turns red, but remains colourless otherwise.
I would appreciate any assistance you can give me.
Currently my data in Influx is the following
measurement: revenue_count
field: users
field: revenue #
timestamp: (auto generated by influx)
What i'm looking to do is find a way to get the average revenue for a day in the week. i.e What is the average revenue for Monday, Tuesday etc.
What's the best way to do this in influx?
You should use continuous queries to schedule automated rollups/downsampling and then select the data from these pre-calculated series.
If you don't have too many points, you might not need the CQ's. In that case an on-the-fly group by will most probably be enough.
I wasn't able to find info on whether you can "select all points for a certain day" by just specifying a date. As far as I know, this is currently not possible because if you specify something like time == '2016-02-22 what this will effectively mean is 2016-02-22 00:00:00 (it won't mean give me everything from 22nd Feb 2016).
What you may need to do is specify an interval (two time points) between which you expect your downsampled point to be placed.
InfluxDB has no concept of days of the week. You can get the average revenue per day, where a day is midnight to midnight UTC with the following:
SELECT MEAN(revenue) FROM revenue_count WHERE time > now() - 7d GROUP BY time(1d)
The question
How do you handle a change in grain (from weekly measurement to daily measurement) for a snapshot fact table.
Background info
For a star-schema design I want to incorporate the results of a survey as a fact (e.g. in week 2 of 2015 80% of the respondents have responded 'yes', in week 3 76% etc.)
This survey is conducted each week, and I only have access to the result of the survey (% of people saying yes this week) and not to the individual responses.
Based on (my interpretation of) Christopher Adamson's "Star Schema: The complete reference" I believe I should use a snapshot fact table for these kind of measurements.
The date dimension for this fact should be on the week-level, and be a conformed rollup of a more fine-grained date dimension for other facts in other stars that take place on a daily basis.
Here comes trouble
Now someone decides they want to conduct these surveys daily instead of weekly. What is the best way to handle this? Some of the options I'm currently considering:
change the week dimension to a daily one, and fake the old facts as if they happened on the last day of the week.
change the week dimension to a daily one, and add 7 facts for each weekly one.
create a new star, with the daily fact and dimension and treat the old one as an aggregate.
I'd appreciate any input. Please tell me if my logic is off, or my question is not clear :)
I'm not convinced that this is a snapshot. Each survey response represents a "transaction".
With an appropriate date dimension you can calculate the Yes/No percentages, rolled up by week.
Further, this would enable you to show results like "Surveys issued on a Sunday night get more responses", or "People who respond on Friday are more likely to answer 'Yes'". (contrived examples)
Following clarification, this does look like a periodic snapshot. The example of a bank account balance is often used to describe a similar scenario.
A key feature of a periodic snapshot is that every combination of every dimension should be present. If your grain is monthly, then every month you record the fact, even if it has not changed from the previous month.
I think that is the key to your problem. Knowing that your grain may change from weekly to daily, make your grain daily. It does mean you'll be repeating the weekly value on every day of the week, but that is a true representation of your knowledge of the fact; on Wednesday you only knew that its value was the same as Monday.
If you design your ETL right, you won't need to make any changes when the daily updates begin.
Your second option is the one I'd choose in your place.
I'm trying to reproduce some of the functionality of the default Clock where I let users select a repeat frequency for an alarm. The problem is that different NSCalendar settings will give you different names for the days of the week. How do I store the selected days of the week in such a way that if the user changes their calendar the frequency always falls on the right day of the week?
One solution would be to check if the calendar has changed every time the app comes into foreground, and if so, make appropriate changes from there. Probably not the most elegant solution, nor the best practice, but it could get the job done.
Take (long) [dateYouWantToRemember timeIntervalSince1970] and store that in a property file or some such. (You could use timeIntervalSinceReferenceDate, but the 1970 number is the "UNIX epoch date" and more standardized -- you can find converters online to check it.)
Later, under the (potentially) different calendar, do [NSDate dateWithTimeIntervalSince1970:theLongYouStored] and you will reconstruct the date, in the new calendar.
Now use NSCalendar/NSDateComponents to find out the new ordinal day of week of that date, and use [NSDateFormatter weekdaySymbols] to fetch a list of the weekday names. Index the list with the ordinal to fetch the new day name. Use NSDateComponents to do arithmetic on you dates to select the next date that is that day of the week, as needed for your app.