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
timazarj
Helper II
Helper II

Customer Loyalty

Hi,

In my model, I need to calculate customer loyalty.  for example, Adam bought a service from us on 15 July 2016, recorded as service effective date and 15 July 2017 as service expiry date, and every year he renewed his service until 1 Jan 2020. I need to come up with a measure to show 3.5 years as Adam's loyalty. Please help me.

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @timazarj ,

 

Try the following formula:

 

Measure = 
CALCULATE(
    DATEDIFF(
        MIN('Table'[effective date]),
        MAX('Table'[expiry date]),
        MONTH
    ) / 12,
    ALLEXCEPT('Table','Table'[customer])
)

 image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

How is your source data structured?  Share data in a format that ca be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-kkf-msft
Community Support
Community Support

Hi @timazarj ,

 

Try the following formula:

 

Measure = 
CALCULATE(
    DATEDIFF(
        MIN('Table'[effective date]),
        MAX('Table'[expiry date]),
        MONTH
    ) / 12,
    ALLEXCEPT('Table','Table'[customer])
)

 image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you! very helpful

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.