cancel
Showing results for
Did you mean:
Member

## Date Calculation from Document Date

Hello,

I am trying to calculate the age of my documents by using the date of my documents.  So If a user selects January 1st in the Calendar slicer all documents with a date in December should have a month age of 1 and so on.

It is not working and the age of the documents are inacurate. Can anyone assist?

Here are the Calculations:

CurrentYM = YEAR ( MAX ( 'Calendar'[Date] ) ) * 12 + MONTH ( MAX ( 'Calendar'[Date] ) )

CurrentDocumentYM =

IF (

HASONEVALUE( Transactions[DateOfInvoice] ),

YEAR ( MAX ( Transactions[DateOfInvoice] ) ) * 12 + MONTH ( MAX ( Transactions[DateOfInvoice] ) )

)

Month Aging = MAX ( [CurrentYM] - [CurrentDocumentYM],0 )

3 REPLIES 3
Super User

## Re: Date Calculation from Document Date

Why don't you use DAX datediff functon to find out the age

https://msdn.microsoft.com/en-us/library/dn802538.aspx?f=255&MSPPError=-2147217396

Proud to be a Datanaut! Appreciate your Kudos
Feel free to email me with any of your BI needs.

Super Contributor

## Re: Date Calculation from Document Date

Cool,

1. do u getting date from different table or same table.

2. If u getting in same table pls duplicate that column, the reason is we going remove filter on other column except that one.

look the image am getting the excat value.

let me know if any help

Community Support Team

## Re: Date Calculation from Document Date

Hi @lcasey,

You can try to use below formula to calculate the diff between slicer and current data filed.

Measures:

Get the selected max date.

maxData = LASTDATE(ALLSELECTED('Calendar'[Date]))

calculate the date diff.

Diff = DateDiff(Max(Transactions[Date]),[maxDate],Day)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |

Announcements

#### Community Highlights

Find out what's new in the Power BI Community!

#### Power Platform Summit North America

Register by September 5 to save \$200

#### Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 311 members 3,446 guests
Recent signins: