Forum Discussion

wlknsnBI's avatar
wlknsnBI
Helper II
6 years ago
Solved

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

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

4 Replies