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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
GKJARC
Resolver I
Resolver I

Date difference between multiple grouped rows

Per customer I'm trying to show the first and last date across multiple rows and calculate the difference in days, in case of consecutive contracts.
A contract is consecutive when ValidFrom is the day after previous row ValidTo, of the same Customer. The consecutive contracts have an adjacent serial number starting with C.
The rows in the table are already grouped by Customer with an index number.

Sample table:
GKJARC_0-1663599724175.png

 

Sample table in text format:

ContractCustomerIndexValidFrom   ValidTo
C2401Joe101-01-1977   04-01-2008
C3720Joe219-07-2018   31-12-2018
C3721Joe301-01-2019   31-12-2019
C3722Joe401-01-2020   31-10-2021
C4860Joe504-06-2022   10-06-2022
C4861Joe611-06-2022   30-08-2022


Expected result:

CustomerFrom   To   DateDiff
Joe19-07-2018   31-10-2021   1200
Joe04-06-2022   30-08-2022   87


Thank you!

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @GKJARC ,

Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.

Best Regards
Lucien

amitchandak
Super User
Super User

@GKJARC , refer if my blog on a similar topic can help

https://community.powerbi.com/t5/Community-Blog/Power-BI-Continuous-Streak-With-One-Day-Break/ba-p/1...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.