Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate customer age from date

Hi all, I want to create a measure that calculates the age of customer in months from the earliest contract start date to the current date. For example, for customer 1 the earliest contract start date is 7/20/18 so I want to have their age be the difference in months from today's date and 7/20/18. 

 

How would I write this measure calculation?

 

CustomerProduct PurchasedContract Start Date
1cloud7/20/18
1data center9/30/18
2cloud8/20/19
2data center8/30/19
2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Create a new column like

datediff(minx(filter(table,[Customer]= earlier[Customer]),[Contract Start Date] ), today(), month)

or
datediff(minx(filter(table,[Customer]= earlier[Customer]),[Contract Start Date] ), today(), year)

View solution in original post

simrantuli
Continued Contributor
Continued Contributor

Hi @Anonymous ,

Try the below measure.

 

simrantuli_0-1596131299211.png

 

Regards

Simran Tuli

View solution in original post

2 REPLIES 2
simrantuli
Continued Contributor
Continued Contributor

Hi @Anonymous ,

Try the below measure.

 

simrantuli_0-1596131299211.png

 

Regards

Simran Tuli

amitchandak
Super User
Super User

@Anonymous , Create a new column like

datediff(minx(filter(table,[Customer]= earlier[Customer]),[Contract Start Date] ), today(), month)

or
datediff(minx(filter(table,[Customer]= earlier[Customer]),[Contract Start Date] ), today(), year)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.