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
Anonymous
Not applicable

Measure of previous 11 months headcount and attrition

Hi,

I have 2 tables of data, one for Headcount and the other for Attrition. What I need is to get a column chart visual that has the current month total attrition + 11 previous month attrition.

Here are the data that I have:

Attrition = SUM (previous 11 months) + current month / Total Current Headcount

i.e. Jan 2021 Attrition = Jan 2021 attrition + Sum (Feb 2020:Dec 2020)/ Jan 2021 HC = 11%

 

Month2020
Vol. Terms
2021
Vol. Terms
2020
Headcount
2021
Headcount

2021

Attrition %

Jan75565126530511%
Feb45375302537811%
Mar60885419552711%
Apr451105553560312%
May46985605565713%
Jun381125711575414%
Jul371115813586115%
Aug46995869591916%
Sep38935931597416%
Oct611165945601917%
Nov67905969604117%
Dec41996051609818%

 

And below table that has the rolling 11 months total that could help with producing the column chart as showing below:

Jan 2021 Rolling 11 Month Total is = Sum (Terms Feb 2020: Dec 2020) = 524

 

Month2021 Vol TermsRolling 11 Month TotalAttrition Rate
Jan5652411%
Feb3753511%
Mar8851211%
Apr11055512%
May9861913%
Jun11267914%
Jul11175415%
Aug9981916%
Sep9388016%
Oct11691217%
Nov9096117%
Dec99101018%

 

zina_t_0-1643566105024.png

My quesiton is how to get the same viz in Power BI? 

Note: the tables in Power BI are like below (Headcount Table & Attrition Table):

 

Headcount Table 
Month20202021
Jan7556
Feb4537
Mar6088
Apr45110
May4698
Jun38112
Jul37111
Aug4699
Sep3893
Oct61116
Nov6790
Dec4199

 

Attrition Table 
Month20202021
Jan51265305
Feb53025378
Mar54195527
Apr55535603
May56055657
Jun57115754
Jul58135861
Aug58695919
Sep59315974
Oct59456019
Nov59696041
Dec60516098

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Assume you have attrition table and headcount table both join to a date table and you are using data table in axis or in visual

Assume you have measures [Attrition] and [Headcount]

MTD Attrition= CALCULATE([Attrition],DATESMTD('Date'[Date]))

MTD headcount= CALCULATE([Headcount],DATESMTD('Date'[Date]))

 

or

CALCULATE(lastnonblankvalues('Date'[Date], [Headcount]) ,DATESMTD('Date'[Date]))

 

 

last 11 month till last month

Rolling 11 = CALCULATE([Attrition],DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-1) ,-11,MONTH))

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Assume you have attrition table and headcount table both join to a date table and you are using data table in axis or in visual

Assume you have measures [Attrition] and [Headcount]

MTD Attrition= CALCULATE([Attrition],DATESMTD('Date'[Date]))

MTD headcount= CALCULATE([Headcount],DATESMTD('Date'[Date]))

 

or

CALCULATE(lastnonblankvalues('Date'[Date], [Headcount]) ,DATESMTD('Date'[Date]))

 

 

last 11 month till last month

Rolling 11 = CALCULATE([Attrition],DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-1) ,-11,MONTH))

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.