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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
JB_AT
Helper III
Helper III

Cumulatively Count Years or Months between Dates

Hello

 

I have a table with columns

 

DateFrom

DateTo

ID

 

DateFrom and DateTo have a inactive relationship with a DIM Date Table. 

 

In a visual, I would like to show the cumulative years over time. Below is the table structure

 

IDDateFromDateTo
101/01/202030/03/2021
101/04/202131/10/2022
101/11/202231/12/2023


I would like the result to look like this

 

YearCulmative Year
20201
20212
20223
20234

 

Thanks

3 REPLIES 3
some_bih
Super User
Super User

Hi @JB_AT you can create calculated column like below to find difference between 2 columns in Years.

Still, I do not understand your logic to get expected results. Provide more details / model.

 

calculated column (adjust your table name)

Diff in Years = DATEDIFF(<Your table name>[DateFrom],<Your table name>[DateTo],YEAR)





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

Proud to be a Super User!






some_bih
Super User
Super User

Hi @JB_AT DateFrom 01/01/2020 is always fix and cumulative should calculate like (DateTo - fixed 01/01/2020)?





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

Proud to be a Super User!






Hi @some_bih 

 

The dates aren't fixed. They would be different for other IDs. The result table below, is if we were just looking at ID 1. So it's basically calculating the Years between DateFrom and DateTo on each row, then breaking these out into years per ID. Hope that makes sense

 

YearCulmative Year
20201
20212
20223
20234

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.