Finding out the difference between two quarter periods in Excel - excel

Need to find out the difference between two quarter periods.
Data as shown below:
Any plan sold year on same quarter (Let's say Oct, Nov or Dec) and the Check Month quarter ( Let's say May, June, July) would have the same difference in the quarter periods.
Need the formula to catch the difference between two quarter periods.
Eg:
Plan Sold Year: 2013 Dec
Check Year: 2018 Feb
Difference in periods: 18 periods (including 2013 quarter period as well)

One way of tackling your question is to work out the Plan Sale Quarter Start Date and Check Quarter End Date, then do a calculation between the two dates to work out the periods (full quarters) in between.
In my solution I used two helper columns being PSQStart and CQEnd that represent the two critical dates mentioned above.
Formulas are:
PSQStart =DATE($A2,FLOOR(MONTH(DATEVALUE("1/"&$B2&"/"&$A2))-1,3)+1,1)
CQEnd =DATE(D2,FLOOR(MONTH(DATEVALUE("1/"&$E2&"/"&$D2))+2,3),30)
Periods =ROUNDDOWN((H2-G2)/90,0)
Drag all three formulas down to apply to all rows.
You can choose to combine the first two formulas into the third one but it will make the formula too long to be easily interpreted and/or edited for future needs.
Here are the main functions used in my solution:
DATE() convert yyyy,mm,dd into a valid date/numerical value for calculations;
DATEVALUE() convert text date dd/mmm/yyyy into a valid date/numerical value for calculations;
FLOOR() work out the start/end month for a given month;
ROUNDDOWN() calculate the number of periods.
Cheers :)

Related

DAX year over year comparison

In a report that I am making in DAX I would like to have year over year comparison of a measure defined as:
Sales Count := CALCULATE(COUNT(fData[PN]);fData[Proc.Type]="CU")
This measure basically counts the amount of sales that were generated. I have a dataset that spans from the beginning of 2014 up to today (16/01/2018). My calendar table consists of a date column, a year column and a month column and is ranges from 01/01/2014 up to 31/12/2018 (to avoid contiguous date errors when using time intelligence functions).
I have defined a measure called PY Sales count as:
PY Sales Count := CALCULATE([Sales Count];SAMEPERIODLASTYEAR(dCalendar[Dates]))
This measure does the job I want it to do, aside from one issue. When comparing the month of january of this year to the month of January to last year, it appears that we are doing terrible. This is because the SAMEPERIODLASTYEAR function considers the FULL month of January for the year 2017 and compares it to the period from the first of January until the 16th of January (today).
I think I should thus try to build a custom measure to 'filter' the date table such that when the year over year measure considers the running month, it only takes the same period as the one on which sales were recorded to compare against, not the full period...
However, due to my sparse DAX experience, I cannot seem to get this right...
If anyone could help/assist me on this, that would be hugely appreciated!
Thanks in advance
I haven't had a chance to test this, but try something along these lines:
PY Sales Count := CALCULATE([Sales Count];
FILTER(dCalendar;
dCalendar[Dates] <= DATEADD(TODAY(), -1, year);
SAMEPERIODLASTYEAR(dCalendar[Dates])))

grouping in an excel pivot table with different year end and quartiles

I have a pivot table with a lot of items currently grouped by date into quartiles and then months under that. My question is this, Our Financial year is not Jan to Jan so can I set up quartiles to reflect this? also our financial periods are not simply set months, they follow the months but are always full weeks around that. for example, P1 this year is 04/07/2015 - 07/08/2015. and Q1 would be 04/07/2015 - 02/09/2015.
Aside from manually grouping is there a way to set this up to happen automatically within Excel?
As stated by pnuts in the question's comments:
The most practical way may be to define the quarters (?) in your source data.
If you are at least using a Gregorian calendar, you may want to subtract an offset from your dates (i.e. # of days between 01-Jan-YYYY and DD-MMM-YYYY ... whereby the offset YYYY doesn't need to be the same as your date's YYYY). By this subtraction you get an "ordinal number" of the date within your business year.
[offset] =[FOY]-DATE(YEAR([FOY]),1,1)
So with your year starting on [FOY]=04-Jul-2015, you have an offset of of 184 days and a normalized date of
[date_normalized] = [current_date]-[offset]
So 04-Jul-2015 will be shrunk to 01-Jan-2015. Now the quarter easily calculates to
=CEILING(MONTH([date_normalized])/3,1)
... or =VALUE(MID("111222333444",MONTH([date_normalized]),1)) ... if you prefer
For your not-quite-months always being full weeks, I suggest to calculate a week number by
=MOD(CEILING(([date_normalized]+1)/7,1)-1,52)+1
to create a weekly reporting period 1 .. 52. With a further =CEILING(.../4,1) this can be converted to quasi-months having 4 weeks each.

Find number of Each Day Type Left in Month (Excel)

Trying to find the number of weekdays LEFT in the month: e.g. 2 Mondays, 2 Tuesdays, etc in excel. Anyone know how I can go about doing this?
Thanks!
Which version of Excel are you using? If you have Excel 2010 you can customise NETWORKDAYS.INTL function to count any single day, e.g. to count Mondays from today until the end of the month (including today) you can use this formula
=NETWORKDAYS.INTL(TODAY(),EOMONTH(TODAY(),0),"0111111")
For Tuesdays use "1011111" for Wednesdays "1101111", etc.
There are specific codes for common "weekends", e.g. 11 for Sunday weekends, but, in fact, you can use any combination of days by using a string as shown - zeroes denote days to be counted, 1s are days to be ignored - the string starts with Monday and ends with Sunday

Excel - Times a month and day occur between 2 dates

I have an Excel sheet where someone types in the date for a yearly bill. I need to know how many times we need to pay that bill between 2 dates.
For example if a bill is due every year on May 31st, the user will type in 5/31/2014. I need to know how many time we will pay that bill between 5/15/2014 and 5/15/2018. (The between dates will change). I can't just take the number of years between the start and end dates because in the example above the start and end dates could be 6/1/2014 and 5/30/2018, in which case I only have to pay the bill in 2015, 2016, and 2017, which makes 3 times.
I have this formula which calculates the number of times a certain day occurs between 2 dates: SUMPRODUCT(--(DAY(ROW(INDIRECT($Q$2&":"&$R$2)))=F4))(Q2 is the begin date, R2 is the end date, and F4 has the day of the month) But I can't figure out how to get this to work for a month and day.
Assuming the specific date in G4 you can use this version
=SUMPRODUCT(--(TEXT(ROW(INDIRECT($Q$2&":"&$R$2)),"ddmmm")=TEXT(G4,"ddmmm")))

Excel Subtracting periods from specific dates using 360-day calendar?

Got formulas for figuring my differences between date periods in days as follows:
=IF(F7="","0",DAYS360(F6,F7)+1)
This gives the days result for each period that I am interested in, but I then need to add each period of days together and subtract them from a current date (like doing service computation). The issue is that I need to do this second calculation within a 360-day calendar as well. If I just try to do a days360() formula with one value being the current date and the other being the total number of days that I need to backtrack, then the "original" date that it comes up with is drastically off.
This seems to be the equivalent of the difference between NETWORKDAYS and WORKDAY functions. The former counts working days between two dates, the latter adds working days to a date, you essentially want the WORKDAY equivalent for DAYS360, which I don't think exists.
You can manipulate DAYS360, though, e.g. with a date in A2 and number of days to subtract (in 360 day mode) in B2 you can use this formula for the date
=A2-B2-MATCH(B2,INDEX(DAYS360(A2-B2-ROW(INDIRECT("1:"&CEILING(B2/30,1))),A2),0),0)

Resources