How do I refresh the database annually? - mongodb

I am storing the user information in my database along with other attributes such as his annual leave/vacation balance.
The user annual leave would be 14 days every year but I want to refresh it every year and add another 14 to it. If the user had 3 days of annual leave left at year's end, then he would start the new year with a 17 day balance.

Just use the percolate:synced-cron package to create an annual job to update such balances.
You might also need a lastUpdatedDate to make sure you don't accidentally add to the balance twice. You have to anticipate any errors that would leave your data partially-updated.

Related

(Google Sheets) How do you get cells to alter based on a certain date?

I'm looking to create a spreadsheet to get a grasp of what my personal finances are saying. Part of this obviously involves putting in income from my job. While I know my shifts in advance so I know how much I will be earning on any given day, I won't actually get the money until the end of the month.
I've created a cell called 'bank balance' based on my current savings, but obviously I don't want to have to physically update this every time I get paid so I'd like to just be able to give Sheets a date where it can update that cell itself based on my payday.
For example:
I start off with £100 in my bank account on January 15th. I know I'm going to get paid £400 on January 28th (last working day of the month). I don't want to input that on Jan 15th as that wouldn't be an accurate reflection of my finances. So I input something that tells sheets to add that £400 on to the bank balance cell on Jan 28th for me.
[The example sheet on January 15th]
[The example sheet on payday January 28th after automatically adding on the £400 to the bank balance]
I've currently got a separate cell for 'work income' that I want to apply this function to (I.E. so that I can tell the sheet to add the total 'work income' to 'bank balance' on payday) but I'm not sure where to go from here.
I've got similar issues with subscriptions leaving my account on various days of the month but the income is my higher priority.
Any help with this would be greatly appreciated

How to count active users daily, weekly and monthly per month Tableau

I am currently trying to count how many distinct users are active:
At least once a day
At least once a week
At least once a month
per month, for every month in the year.
Ideally the output will be like this chart that is attached
What I have done so far is following this instructions "13. User login frequency" (https://www.tableau.com/about/blog/LOD-expressions).
This example is not what I am looking for because this calculates an average in all the months of the year and I need to calculate per month how many users are active at least once a day, how many users are active at least once a week and how many users are active ar least once a month.
Thank you very much

Google Sheets: Automatically Increment Date by 1 Month

I am currently using a budget sheet that automatically updates date cells to the next "payment" date for a bill. As an example:
=VALUE("2019-03-08")+14*FLOOR((NOW()-VALUE("2019-03-08"))/14)
The cell starts with a date and it then updates every 14 days to the new date. This shows me a cell that has the date of the biweekly payment that is due. In the above example, the cell shows the value of "2019-03-08" until 2 weeks have passed. Once 14 days have passed, the cell will automatically upload to "2019-03-22". This automation will continue forever in 14-day increments. The date displayed in the cell will always update automatically to the next 14-day date. This helps me display the exact due date of a biweekly payment without updating the cell.
I want to do the same thing for a monthly payment, but using a day count of 30 is not very accurate. Is there a way to modify this method to let me update the date automatically to the 24th of the month, every month, on that day. So I start with 2/24/2019 and when 3/24/2019 hits, the cell updates to that date, and so on. The reason this is not accurate is that the months are not all 30 day periods. February is 28 days and some are 31 days. I want the cell to increment in 1 month periods in the same way that the above formula updates in 14-day increments. As an example: The date will display "2/24/2019" until the same day on the next month occurs, then the cell will update to "3/24/2019". This process will continue forever with 4/24/2019, 5/24/2019, etc. It will continue with the year as well, so 12/24/2019 will change automatically to 01/24/2020.
UPDATE: Updated the description with examples of how the behavior works and what I am looking for...
It's much simpler than this. Use the EDATE function (e.g.):
=EDATE(A1,1)
Where A1 is your starting date and 1 is the number of months you which to increment by. See https://support.google.com/docs/answer/3092974?hl=en for more details.
this formula will increase the month every 24th and accounts for year change as well
=IF(DAY(TODAY())>=24,
DATE(YEAR(TODAY()), MONTH(TODAY())+1, 24),
DATE(YEAR(TODAY()), MONTH(TODAY()), 24))
paste where you need and drag down:
=VALUE("2019-"&ROW(A3)&"-08")+14*FLOOR((NOW()-VALUE("2019-"&ROW(A3)&"-08"))/14)

Identify and name a timestamp for specific data entry points

I have a situation where I'm trying to look at changes in data based on timestamp of user entry (or 'created on').
The data highlights planning for delivery of goods, users have the ability to 're-plan' their dates of entry.
What I need to do is look at the timestamp for each 're-planning' date and be able to tell if the date of planning was changed within 7 days of delivery. For example
Data line XXY was planned for delivery on the 29th of August, 2017...but was changed, ON the 27th, to the 30th....this is a flag...
Like wise XXZ was planned for the 30th but changed to September 15th on the 29th...also a flag. Both were changed within 7 days of their previous 'delivery' date. Does this make sense and is there a simple way to do this?

How do I set the date to always read last Saturday in Tableau?

I do weekly reporting in Tableau and each page is labelled to say data is pulled through every Saturday (Image below).
My question is if there is a way to program that date to update every week on its own, without having to manually do it for every page on a 52 page report?
I'm not looking to update any data fields, just that label for each page.
See the below link on how you can pull in the last data refresh date:
http://kb.tableau.com/articles/howto/adding-data-refresh-time-stamp-to-view
Or you could have one calculated field that hold this date and add it to every page/view. Then you just have to update one field which will update every view.