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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
pbreslin24
Regular Visitor

Calculating Between 2 dates over 2 months

Hello All! 

 

I am trying to calculate days in each month from a start date and End date that spans over 2 or 3 months. I can get the dates correct for each project just by calculating the difference between dates but i am not able to look at how many days are in each month graphically. Is there a way to add a colum or measure to show how many days are in each month or is there a way to graph how many days are in each month when it is 2 or 3 different months?

 

pbreslin24_0-1624508423652.png

 

Thank you All!

Pbreslin

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@pbreslin24 , I made a similar attempt in past, see if the attached pbix can help

 

or this blog

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-o...

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@pbreslin24 , I made a similar attempt in past, see if the attached pbix can help

 

or this blog

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-o...

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

This saved my day, thank you amitchandak!
I have a followup question to this. How would one using your soulution:

Day by Month = CALCULATE(countx(SUMMARIZE(filter(CROSSJOIN('Data','Date'),'Date'[Date] >= 'Data'[StartDate] && 'Date'[Date]<= 'Data'[EndDate]),'Data'[id],'Date'[Date]),'Date'[Date]))

Calculate the value accumulated?
It works perfect specifying the number of days in each month but I need to vizualise the values accumulated over a year and I can't get it to work.

Edited: I believe i have it working now. My mistake was trying to use my own date selection to look at a table with the new measure. I needed to use the new table created and its working. Checked Manually for a few months and its good. Thank you for the help!!

 

Previous:

(Thank you for the reply. When i use this method it still adds the total value into whatever month the Data(startdate) is in. It did not divide the dates into each month. Below is my typed out measure. It is calculating the value correctly for total days between 2 dates. Am i missing part? 

 

Value by day of Month = CALCULATE(SUMX(SUMMARIZE(filter(CROSSJOIN('Work Order','Date'),'Date'[Date] >= 'Work Order'[Account Start Date] && 'Date'[Date]<= 'Work Order'[Account End Date]),'Work Order'[Name],'Date'[Date],'Work Order'[Account Rev Days],'Work Order'[Account Start Date],'Work Order'[Account End Date]),DIVIDE('Work Order'[Account Rev Days],DATEDIFF('Work Order'[Account Start Date],'Work Order'[Account End Date],DAY)+1)))

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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