DAX Function Guide

YEARFRAC
Empty image or helper icon

Sam McKay

CEO & Founder

How does the YEARFRAC work?
The YEARFRAC function calculates a fraction of the year between two dates, representing the number of whole days. Use the YEARFRAC worksheet function to identify the proportion of benefits or obligations that must be assigned to a specific term for an entire year.
YEARFRAC Formula Syntax
 = YEARFRAC (
<start_date>, <end_date>, <basis>
) 
How do you use the YEARFRAC?

You can use the YEARFRAC function to identify the proportion of the benefits or obligations of an entire year to be assigned to a particular term.

Related Blog Posts

Loading

Considerations when using the YEARFRAC?

If start_date or end_date are not valid dates, YEARFRAC returns an error.

If basis < 0 or if basis > 4, YEARFRAC returns an error.

Related Video Tutorials

Loading

Formula examples using the YEARFRAC

The following example returns the fraction of a year which is the difference between the dates in the two columns, TransactionDate and ShippingDate:

=YEARFRAC(Orders[TransactionDate],Orders[ShippingDate])

The example below gives the fraction of a year represented by the difference between the dates 1 January and 1 March:

=YEARFRAC("Jan 1 2007","Mar 1 2007") 

Whenever possible, use four-digit years to avoid getting unexpected results. The current year is assumed, when the the year is truncated. The first date of the month is assumed when the date is or is omitted.

The second argument, basis, has also been omitted. Therefore, the year fraction is calculated according to the US (NASD) 30/360 standard.

Related Courses

Loading