I have a table of data that has a format similar to the following:
EventID | Event Date
--------------------
1 | 1/1/2014
2 | 2/8/2014
3 | 10/1/2014
4 | 2/5/2014
5 | 4/1/2014
6 | 9/1/2014
What I am trying to do is create a DAX formula to rank each event in the order that it happened for the year. So I want to end up with something like this. This way I can compare the events year over year as the events don't happen on any regular time schedule.
Event Date | Year | Rank
------------------------
1/1/2014 | 2014 | 1
2/8/2014 | 2014 | 2
10/1/2014 | 2014 | 3
2/5/2015 | 2015 | 1
4/1/2015 | 2015 | 2
9/1/2015 | 2015 | 3
I have tried to do this by creating a formula that will give me the day number of the year:
Day of Year =(YEARFRAC(CONCATENATE("Jan 1 ", YEAR([Event Date])),[Event Date])*360)+1
Then using rankX on this table, but I cant seem to get the proper result. Perhaps I am not understanding the use of rankX or going about this the right way.
=RANKX(FILTER(Event,EARLIER(Event[Event Year])=Event[Event Year]),Event[Day of Year])
or
=RANKX(All(Event[Event Year]),[Day of Year],,1,Dense)
Any ideas would be much appreciated!
Thanks for any help in advance!
Create the following measures:
[Year]:=YEAR(LASTDATE(Event[Event Date]))
and
[Rank]:=RANKX(FILTER(ALL(Event),[Year]=YEAR(MAX(Event[Event Date]))),FIRSTDATE(Event[Event Date]),,1,DENSE)
and this is the result that you get:
Note: My dates are in UK format and I suspect yours were in US format, so the rankings do not appear to tally with your example, but it does work!
Related
I have a series of values (concentrations of ions in the atmosphere) each plotted in function of their date that looks a little bit like this
+---------+----------+---------+
| Year | Sulphate | Nitrate |
+---------+----------+---------+
| 2008.0 | 22.8 | 12.5 |
| 2007.75 | 13.5 | 13.4 |
| 2007.5 | 10.2 | 12.7 |
| 2007.25 | 19.4 | 10.3 |
| 2007.0 | 25.4 | 12.4 |
+---------+----------+---------+
is there a way to convert the year in a proper date? Like, 2008 should become 01/01/2008 (first of jan of 2008) etc.
If you want to display a proper date (middle of the year, a quarter of the year, etc.) then you can try the following formula:
=DATE(LEFT(A1,4),1,1)+(DATE(LEFT(A1,4)+1,1,1)-DATE(LEFT(A1,4),1,1))*MOD(A1,1)
Here's the result:
Another method, that might come a bit closer:
=DATE(INT(A2),MOD(A2,1)*12+1,MOD(MOD(A2,1)*12,1)*30+1)
The formula assumes all months have 30 days.
Understand that, because months have different numbers of days, that a formula like this may not always give an "exact" result.
is there a way to convert the year in a proper date? Like, 2008 should become 01/01/2008
Yes, with the Function DATE:
DATE Function
Also with function LEFT to get the first 4 chars.
LEFT Function
My formula in B2 is:
=DATE(LEFT(A2;4);1;1)
Hope this helps.
I would like to generate a chart with the monthly status of opened claims based on the creation date and closing date.
Let's suppose I have 3 claims:
Claim No. | Date created | Date closed
X7348 | 01.Jan | 01.April
Y6778 | 01.Mar | 01.April
G7847 | 01.Feb | 01.May
The chart should indicate the status like this:
Jan | Feb | Mar | Apr | May | Jun
1 | 2 | 3 | 3 | 1 | 0
So, claim X7348 had the status open in Jan, also in Feb, Mar and April.
Update:
In fact my data's have and XML source and loaded into a Table which can change the range.
I think the result must come from a Pivot.
I've tried to create a calculated field with COUNTIFS formula behind, but give some errors like the one attached:
=COUNTIFS(DATE_C3,"<="&DATE_C3,DATE_D5_COMP,">="&DATE_C3")
Create your desired months Jan|Feb...as dates
Then, you can use date math to get it.
For example, here, I put your input data in A1:C4
The formulas for each month of output are like:
=COUNTIFS($B2:$B4,"<="&F1,$C2:$C4,">="&F1)
So my company services clients with insurance products and we have two teams: Liability and Crime. There are generally one 4 different types of task: Binding, Issuance, Quoting and Rapids.
I currently have made a spreadsheet based on data obtained through our workflow.
The main formulas I use to calculate service due date for Crime/Liability team is:
=IF(OR(WEEKDAY(IF(A2="Binding",C2+(1/8),IF(A2="Quoting",C2+(1/8),IF(A2="Issuance",C2+2,IF(A2="Rapids",C2+(1/8),"")))))=1,WEEKDAY(IF(A2="Binding",C2+(1/8),IF(A2="Quoting",C2+(1/8),IF(A2="Issuance",C2+2,IF(A2="Rapids",C2+(1/8),"")))))=7,IF(A2="Binding",C2+(1/8),IF(A2="Quoting",C2+(1/8),IF(A2="Issuance",C2+2,IF(A2="Rapids",C2+(1/8),"")))))+2,IF(A2="Binding",C2+(1/8),IF(A2="Quoting",C2+(1/8),IF(A2="Issuance",C2+2,IF(A2="Rapids",C2+(1/8),"")))))
Where you have 3 hours to finish binding, quoting, rapids, and you have two days for issuance.
We are now expanding our service to California, which is three hours behind EST time, so now comes the issue: We want to expand our working hours (est time) to 9 am - 8 pm to cover west coast. But, does is it possible to tell excel to do that via a weekday/workday function?
The goal is to have the due dates wrap around weekends to Monday and anything after 8 pm (est time) to being due next day.
For example: If a binding task comes in at 7:00 pm, then you would have 1 hour till 8 pm, and so the task would be due at 11:00 am the next day. Is this even possible to do with just excel? Any help would be immensely appreciated guys, thank you!
Your formula can be simplified greatly if you have a lookup table in your workbook somewhere that returns the due time values. For the example below, my lookup table is in Sheet2, A1:
Sheet 1 - Example Data
| A | ... | C | D |
+--------+ ... +-----------------+----------------+
1 | Task | | Received | Due |
2 |Binding | |19/02/2018 09:00 |19/02/2018 12:00|
3 |Quoting | |19/02/2018 13:00 |19/02/2018 15:00|
Sheet 2 - Lookup table:
| A | B |
+--------+-------+
1 |Binding | 0.125 |
2 |Quoting | 0.125 |
3 |Issuance| 2 |
4 |Rapids | 0.125 |
Formula
The formula in Sheet1 D2 is:
=C2+INDEX(Sheet2!B:B,MATCH(Sheet1!A2,Sheet2!A:A,0))
From there it should be a lot simpler to construct an IF STATEMENT to rollover to the next day if the order is received past 5pm (would be due after 8pm).
I receive a statement (as a .xls) each month which list a bunch billable items with an associated date. I want to create a formula (using either =sum() or =sumifs() to total the billable items, but only those which fall Monday to Friday (i.e., not weekends). Is that possible?
A B
------+--------------+-------------
1 | 05/12/2016 | $10.00
2 | 06/12/2016 | $10.00
3 | 07/12/2016 | $10.00
4 | 08/12/2016 | $10.00 dates are formatted as
5 | 09/12/2016 | $10.00 dd/mm/yyyy
6 | 10/12/2016 | $10.00
7 | 11/12/2016 | $10.00
8 | 12/12/2016 | $10.00
------+--------------+-------------
| Sum | $80.00
------+--------------+-------------
| Sum |
| (no weekends)| $60.00
------+--------------+-------------
EDIT:
I've just looked closer at the excel doc, and it's actually a datetime field, e.g. 31/10/2016 12:44:00 pm (displayed as 31/10/16 12:44).
I'm also not looking for a formula which works line by line, I'd like something which I can just copy and paste into a single cell at the bottom of the doc each month which examines A:A.
You need to use this formula:
=SUMPRODUCT(B1:B8,--(WEEKDAY(A1:A8,2)<6))
This is a hack which behaves like SUMIF but lets you use a function in your criteria. Otherwise, you would need to create an auxiliary column with WEEKDAY (in C for example) and then use =SUMIF(C1:C8,"<6",B1:B8).
WEEKDAY by default returns 1-7 for SUN-SAT. As this doesn't help, you can change the return type to type 2 with the optional second parameter to make the function return 1-7 for MON-SUN, which lets you do the easy <6 comparison. You can also use type 3, which returns 0-6 for MON-SUN, and then obviously use <5 instead.
More about the -- hack here.
I have a table in excel setup as followed:
DATE | TIME | PERSON IDENTIFIER | ARRIVAL OR LEAVING
01/01/15 | 13:00 | AB1234 | A
01/01/15 | 13:01 | AC1234 | A
01/01/15 | 13:03 | AD1234 | A
01/01/15 | 13:05 | AE1234 | A
01/01/15 | 13:09 | AF1234 | A
01/01/15 | 13:10 | AB1234 | L
01/01/15 | 13:15 | AG1234 | A
01/01/15 | 13:13 | AC1234 | L
The table shows when people arrive and leave a medical ward. The ward holds 36 patients and I'm wanting to get an idea of how close it is to capacity (it's normally always full). The ward is open 24/7 and has patients arriving 24/7 but I'd like to show the time it is at the certain capacities.
For example if we inputted 24 hours of data
36 patients (0 empty beds) - 22hr 15min
35 patients (1 empty bed) - 01hr 30min
34 patients (2 empty beds) - 00hr 15min
I'm thinking we just need a count for every time some arrives and a negative count when they leave but I can't figure out how to extract the time from that.
This is going to be pretty ugly (NB using your columns from above):
order the entries sequentially
you can keep a running tally in column E of patients on hand currently with E1 = 36(or whatever starting value you have) and =IF(D2="A",E1+1,E1-1).
Get the time elapsed since the previous entry with =(B3-B2) and put that in column F
Count the chunks where you had less than a full house with =SUMIF(F:F, "<36")