cancel
Showing results for 
Search instead for 
Did you mean: 
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...



!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!

View solution in original post

2 REPLIES 2
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...



!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!

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
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors
Top Kudoed Authors