Forum Discussion

Dhavales's avatar
Dhavales
New Member
6 years ago
Solved

Attrition Formula

MonthHC
End of M-1
TotalNon
Voluntary
VoluntaryMonthly
Attrition
%
Annual
Attrition
%
Jun 19782215162.05%0.00%
Jul 197628710.13%0.00%
Aug 19752266202.66%0.00%
Sep 19748185131.74%0.00%
Oct 197738170.91%0.00%
Nov 1978113760.77%0.00%
Dec 19807175121.49%17.60%
Jan 208125140.49%16.32%
Feb 208362010101.20%16.28%
Mar 20834153121.44%16.36%
Apr 20850174131.53%16.40%
May 208545050.59%14.98%
May 20854505=E19/B19=SUM(F8:F19)
       
   Monthly % = (Total - Non Voluntary)/Head Count for the month
   Annual % = Sum(past 12 months monthly%)

 

Hi Friends,

I am trying to calculate the above in Power BI.. above example is done in excel.

How do i get the Annual% rolling past 12 months in a measure?

 

The one in Green colour is the formula of excel..

 

Please help

Thanks

Sachin

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Dhavales ,

     

    Based on my understanding,Annual %= Sum(past 12 months monthly%) should be a summarize of the pasting 12 months,I dont understand why from Jun 19 to Nov 19,the result returns 0?And why the value in Dec 19 is higher than the later values.

    I made a sample .pbix file to calculate the total value if I didnt understand wrong,pls see below:

    Create a measure as below:

     

    Annual Attrition% = 
    var _mindate=CALCULATE(MAX('Table'[Date]),DATEADD('Table'[Date],-12,MONTH))
    Return
    SUMX(FILTER(ALL('Table'),'Table'[Date]>=_mindate&&'Table'[Date]<=MAX('Table'[Date])),'Table'[Monthly %])

     

    And you will see:

    For the related .pbix file,pls click here.

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Dhavales ,

     

    Based on my understanding,Annual %= Sum(past 12 months monthly%) should be a summarize of the pasting 12 months,I dont understand why from Jun 19 to Nov 19,the result returns 0?And why the value in Dec 19 is higher than the later values.

    I made a sample .pbix file to calculate the total value if I didnt understand wrong,pls see below:

    Create a measure as below:

     

    Annual Attrition% = 
    var _mindate=CALCULATE(MAX('Table'[Date]),DATEADD('Table'[Date],-12,MONTH))
    Return
    SUMX(FILTER(ALL('Table'),'Table'[Date]>=_mindate&&'Table'[Date]<=MAX('Table'[Date])),'Table'[Monthly %])

     

    And you will see:

    For the related .pbix file,pls click here.

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!

     

    • Dhavales's avatar
      Dhavales
      New Member

      Dear Kelly..

       

      Super cool.... it definitely helped 

       

      Thanks for the quick solution..

       

      Regards

      Sachin Dhavale