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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sureshcu
Helper I
Helper I

Month on Month YTD Attrition Percentage

Hi,

I need to display Month on Month Attrition percentage from Jan’17 to Aug’17 in clustered column chart. I am able to get Aug’17 month attrition % with the following formula.

 

% Annualized Attrition=Total YTD Attrition/Average of Headcount*(12/currentmonth)

 

I have written following measure to get current month number. The current month measure works fine for Aug’17.

 

Currentmonth = FORMAT(MAX(Append1[Reporting Month]),"MM") ‘which gives 08

 

But Current month is picking only 08 for all the months. How to get the current month number dynamically as below

 

for January month currentmonth should be 01

for February month currentmonth should be 02

for March month currentmonth should be 03

for April month currentmonth should be 04

for May month currentmonth should be 05

for June month currentmonth should be 06

for July month currentmonth should be 07

for August month currentmonth should be 08, It works fine as August is the current Month

1 ACCEPTED SOLUTION

Hi @sureshcu,

 

You can first SUMMARIZE Heacount Table and Attrition tabletable so that you will get the table structure as I mentioned in above port.

 

For Example:

New Table=SUMMARIZE(HC , HC[Hiring Month] , "Total HeadCount", SUM(HC[Emp ID]))

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

6 REPLIES 6
v-yulgu-msft
Employee
Employee

Hi @sureshcu,

 

According to current description, it looks like the sample table structure doesn't match the formula you provided. So, I assumed that the source table structure should be:

1.PNG

 

If it isn't similar to your real table, please convert your table to above structure via unpivot, new calculated table or any other operation.

 

Based on above table, you should create some calculated columns.

YTD =
IF (
    Append1[HeadCount Month].[MonthNo] >= MONTH ( TODAY () ),
    0,
    CALCULATE (
        SUM ( Append1[Attribution Number] ),
        FILTER (
            Append1,
            Append1[HeadCount Month] <= EARLIER ( Append1[HeadCount Month] )
        )
    )
)

Average HeadCount =
CALCULATE (
    AVERAGE ( Append1[HeadCount] ),
    FILTER (
        Append1,
        Append1[HeadCount Month] <= EARLIER ( Append1[HeadCount Month] )
    )
)

% Annualized Attrition =
Append1[YTD] / Append1[Average HeadCount]
    * 12
    / Append1[HeadCount Month].[MonthNo]

2.PNG

 

Then, use a Matrix visual to display data.

3.PNG

 

Best regards,
Yuliana Gu

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

Hi,

 

Thanks for your effort. I have shared only summary which was consolidated in excel. I have two tables Headcount and attrition which was appended in Power BI. I have given source name HC for Heacount Table and ATTR for Attrition table. Entire data was uploaded in Power Bi from excel which is not summarized.  the following data is the example. i don't think Percentage can be achieved through calculated column. for example January Head coutn is 507. it will have 507 rows. Please help

 

Untitled1.png

Hi,

 

any thoughts?

Hi @sureshcu,

 

You can first SUMMARIZE Heacount Table and Attrition tabletable so that you will get the table structure as I mentioned in above port.

 

For Example:

New Table=SUMMARIZE(HC , HC[Hiring Month] , "Total HeadCount", SUM(HC[Emp ID]))

 

Regards,
Yuliana Gu

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

Can you post sample data? It would seem to me that if you created a table visualization and put your month name in it along with your measure that you would get the right answer per month as the context of the table row would constrain the calculation of Current Month.

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi,

 

Here is the sample data

 

Test.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.