Showing results for 
Search instead for 
Did you mean: 
lcasey Member

Date Calculation from Document Date



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 )




Super User
Super User

Re: Date Calculation from Document Date

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



Did I answer your question? Mark my post as a solution.

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

Baskar Super Contributor
Super Contributor

Re: Date Calculation from Document Date



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
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.




Get the selected max date.

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


calculate the date diff.

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



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: | |

Helpful resources

Community Highlights

Community Highlights

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

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

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.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 311 members 3,446 guests