number of months between two dates in salesforce - salesforce

I have a report in Salesforce that contains an Estimated Start Date and Estimated End Date - see below example:
What I want to do is create a formula column that will allow me to show how many months are between those dates.
I can do this easily in excel using DATEDIF but cannot replicate that in the salesforce report itself - see below example of desired result using DATEDIF in excel:
Can anyone advise on the easiest way to achieve this result as a formula column in Salesforce?
Many thanks

I did this by creating a field with the below formula
((CloseDate - Estimated_Start_Date__c) /(365/12))

Related

Filter an array containing dates

Hi,
I'm trying to do the following in google sheet:
I have a table with dates and expenses (A2:E7) and I would be able to filter them by changing the values in cell H1 and H2. This would in turn generate as result a new table ranging from J2 to N?. My plan is to continue populating the A2:E7 table so it will grow in time but to still be able to look at my datas between two dates.
How can this be done?
Thanks in advance,
try:
=FILTER(A2:E; A2:A>=H1; A2:A<H2)

How can I calculate between two dates per User Pseudo ID for specific events?

I linked Firebase to BigQuery and start using Google Data Studio to create a table to list users by "User Pseudo ID".
My goal is to calculate the difference between two dates, the date of first_open and the date of app_remove to come up with an average retention time.
How can I write the right query in Data Studio?
It can be achieved using the three step process below:
1) HH:MM:SS
The Calculated Field below uses the DATETIME_DIFF function to find the difference between app_remove and first_open, and displays the difference in SECOND (for future reference, set the third input DATETIME_DIFF as required, for example, to view the difference in days, set the input to DAY):
DATETIME_DIFF(app_remove, first_open, SECOND)
2) Type (HH:MM:SS)
Number > Duration (Sec.)
3) Aggregation (HH:MM:SS)
AVG
Google Data Studio Report and a GIF to elaborate:
DATE_DIFF may be what you are looking for.
That is if first_open and app_remove are date fields or date expressions

How do I create a default everyday date dimension?

I am trying to create a line chart counting all the optins per date, however the only dimension that is will allow me to choose from have to be a date column on my source. The problem with this is it only chooses from dates that are populated in those fields with an optin date.
For example: I have 5 optins on 1/1/2019, 0 on 1/2/2019, and 3 on 1/3/2019
If I use this series and want to include another metric, 1/2/2019 will not show anything for that other metric
I just want a standard everyday series that counts every metric on a given day. The google analytics connection source has a generic Date dimension but I can not figure out how it was done
Ive tried creating a new column with everydate on it and trying to use that as a dimension without any luck
You should be able to use a Time Series graph (of which there are 3 types) instead of a Line graph.
A Time Series will keep the days where no data is available unlike the Line Graph which only presents labels for those which have values in the data.

Google Data Studio date aggregation - average number of daily users over time

This should be simple so I think I am missing it. I have a simple line chart that shows Users per day over 28 days (X axis is date, Y axis is number of users). I am using hard-coded 28 days here just to get it to work.
I want to add a scorecard for average daily users over the 28 day time frame. I tried to use a calculated field AVG(Users) but this shows an error for re-aggregating an aggregated value. Then I tried Users/28, but the result oddly is the value of Users for today. The division seems to be completely ignored.
What is the best way to show average number of daily users over a time frame? Average daily users over 10 days, 20 day, etc.
Try to create a new metric that counts the dates eg
Count of Date = COUNT(Date) or
Count of Date = COUNT_DISTINCT(Date) in case you have duplicated dates
Then create another metric for average users
Users AVG = (Users / Count of Date)
The average depends on the timeframe you have selected. If you are selecting the last 28 days the average is for those 28 days (dates), if you filter 20 days the average is for those 20 days etc.
Hope that helps.
I have been able to do this in an extremely crude and ugly manner using Google Sheets as a means to do the calculation and serve as a data source for Data studio.
This may be useful for other people trying to do the same thing. This assumes you know how to work with GA data in Sheets and are starting with a Report Configuration. There must be a better way.
Example for Average Number of Daily Users over the last 7 days:
Edit the Report Configuration fields:
Report Name: create one report per day, in this case 7 reports. Name them (for example) Users-1 through Users-7. These are your Row 2 values. You'll have 7 columns, with the first report name in column B.
Start Date and End Date: use TODAY()-X where X is the number of days previous to define the start and end dates for each report. Each report will contain the user count for one day. Report Users-1 will use TODAY()-1 for start and end, etc.
Metrics: enter the metrics e.g. ga:users and ga:new users
Create the reports
Use 'Run reports' to have the result sheets created and populated.
Create a sheet for an interim data set you will use as the basis for the average calculation. The first column is date, the remaining columns are for the metrics, in this case Users and New Users.
Populate the interim data set with the dates and values. You will reference the Report Configuration to get the dates, and you will pull the metrics from each of the individual reports. At this stage you have a sheet with date in first columns and values in subsequent columns with a row for each day's values. Be sure to use a header.
Finally, create a sheet that averages the values in the interim data set. This sheet will have a column for each metric, with one value per column. The one value is calculated from the series in the interim data set, for example =AVG(interim_sheet_reference:range) or any other calculation you'd like to do.
At last, you can use Data Studio to connect to this data source and use the values. For counts of users such as this example, you would use Sum as the aggregation field type when you are creating the data source.
It's super ugly but it works.

How to add formula in SQL Server and calculate the day of due?

I want to add the formula in one of my column in SQL Server named (Day to due). The formula will calculate how many days the equipment to reach the due date. I have used the formula in the excel but it can work successfully.The formula is (DueDate cell - Today()).
So i want to implement the formula in SQL Server . Anyone can help about this?
Use DATEDIFF
in your example: DATEDIFF(day,GETDATE(),DueDate) AS Days_Until_DueDate
A negative date will indicate the number of days a project is overdue.
As per MSDN from Microsoft https://msdn.microsoft.com/en-us/library/ms189794.aspx

Resources