Forum Discussion
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?
| Customer | Product Purchased | Contract Start Date |
| 1 | cloud | 7/20/18 |
| 1 | data center | 9/30/18 |
| 2 | cloud | 8/20/19 |
| 2 | data center | 8/30/19 |
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)Hi Anonymous ,
Try the below measure.
Regards
Simran Tuli
2 Replies
- amitchandak
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) - simrantuli
Continued Contributor
Hi Anonymous ,
Try the below measure.
Regards
Simran Tuli