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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
wlknsnBI
Helper II
Helper II

Months between two dates (+decimals)

Hi,

 

I'm looking to get the months between two dates, plotted onto table like below (using calendar table probably). What would be the measure to make that happen to include partial months (looking at total days of month and dividing how much left or have allready passed)?

 

StartEnd         
10/09/201918/01/2020         
  Months        
           
  201909201910201911201912202001  20192020
  0,6666671110,580645  3,6666670,580645

 

Big thanks

1 ACCEPTED SOLUTION
v-diye-msft
Community Support
Community Support

Hi @wlknsnBI 

 

Please kindly check below results:

Table = ADDCOLUMNS(CALENDAR(DATE(2019,01,01),DATE(2020,12,31)),"YearM",YEAR([Date])*100+MONTH([Date]))
Measure = var y = MAX('Table'[YearM])
return
DIVIDE(COUNTROWS('Table'),CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[YearM] = y)))

 03.PNG

Pbix attached.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

4 REPLIES 4
v-diye-msft
Community Support
Community Support

Hi @wlknsnBI 

 

Please kindly check below results:

Table = ADDCOLUMNS(CALENDAR(DATE(2019,01,01),DATE(2020,12,31)),"YearM",YEAR([Date])*100+MONTH([Date]))
Measure = var y = MAX('Table'[YearM])
return
DIVIDE(COUNTROWS('Table'),CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[YearM] = y)))

 03.PNG

Pbix attached.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User

@wlknsnBI ,

 

Refer to file for the solution you are looking for. You just need to take care how you want to datediff. I included first and last date

https://www.dropbox.com/s/yuv64v0cneseghx/value%20Split%20between%20months%20start%20end%20date.pbix...

Bit different but also on similar line

https://www.dropbox.com/s/5wo5jhzl488zy69/Minute_between%20Hours.pbix?dl=0

 

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
Greg_Deckler
Community Champion
Community Champion

Right, so you are going to want something along the lines of Hour Breakdown:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Hour-Breakdown/m-p/625085#M306

 

Remember that Dates/Times are just decimal numbers the whole part of the number is the number of days and the decimal is time. So, you could construct a measure like the Hour Breakdown that returns 1 if the entire month is spanned and in the situations where there is a partial month, do the simple calculation to compute the part of the month. Remember that all months have a 1st and you can use EOMONTH([Month],0) to get the end of the month.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I was actually thinking of something more simple. First of all, calendar table to match which month is being selected (for the table) between two dates.  After a which I calculation for which the selected applies.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.