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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Cumulate values between two date fields

Hello,

 

I face an issue that looks simple but I don't find the trick.

 

My wish is to display on a visual the power cumulated year by year of the plants between StartDate and EndDate

Our first table contains information on plants :

LocationsPowerStartDateEndDate
Plant112002016-05-012019-12-01
Plant290002018-01-01 
Plant360002018-08-012022-11-01
Plant424002021-01-01 
Plant5150002024-06-01 

 

The expected result is :

YearCumulatedPower
20161200
20171200
201816200
201916200
202015000
202117400
202217400
202311400
202429400

 

I tried many things and each time I'm really close from the expected result but there is always a little problem happening.

Only one rule to apply for my case : we can use a calendar table but we can't add a relationship between the calendar table and the table which contains the startDate and the EndDate.

 

How would you proceed ?

 

Thanks in advance.

Best regards,

Cado

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

 

Picture1.png

 

Power Measure =
IF (
ISFILTERED ( Dates ),
CALCULATE (
SUMX (
Plants,
Plants[Power]
),
FILTER (
Plants,
Plants[StartDate]
<= MAX ( Dates[Date] )
&& OR (
Plants[EndDate]
>= MIN ( Dates[Date] ),
Plants[EndDate]
= BLANK ()
)
)
)
)
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

 

Picture1.png

 

Power Measure =
IF (
ISFILTERED ( Dates ),
CALCULATE (
SUMX (
Plants,
Plants[Power]
),
FILTER (
Plants,
Plants[StartDate]
<= MAX ( Dates[Date] )
&& OR (
Plants[EndDate]
>= MIN ( Dates[Date] ),
Plants[EndDate]
= BLANK ()
)
)
)
)
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hi @Jihwan_Kim 

 

Thank you for helping me, the measure you propose works fine until 2021 but the following years are not displayed in the visual. Do you know where could the problem come from ?

Cado_0-1623935294110.png

In the database there are a lot of rows with StartDate in 2022 2023 2024 2025 but nothing on the visual.
I already tried the "Show items with no data" option and still nothing after 2021.

I also check the external filters and nothing should be disturbing the measure.

Hi, @Anonymous 

Thanks for your feedback.

Please share your sample pbix file's link here, then I can try to look into it to come up with a solution.

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

@Jihwan_Kim 

 

Sorry the problem came from my calendar table (parenthesis misplaced in the CALENDAR formula) so the last date was in 2021 instead of 2025 😅

Thank you again for the measure and have a nice day !

 

Best regards,

Cado

amitchandak
Super User
Super User

@Anonymous , refer if this blog can help

How to divide/distribute values between start date or end date or count days across months/days: https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785

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

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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