Forum Discussion

pbreslin24's avatar
pbreslin24
Regular Visitor
5 years ago
Solved

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?

 

 

Thank you All!

Pbreslin

3 Replies

    • pbreslin24's avatar
      pbreslin24
      Regular Visitor

      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)))
    • NoccoLoco's avatar
      NoccoLoco
      Frequent Visitor

      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.