Forum Discussion
Months between two dates (+decimals)
- 6 years ago
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)))Pbix attached.
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.
- wlknsnBI6 years agoHelper II
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.