Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Everyone and
@Ashish_Mathur @amitchandak
I Have months from April to March as I follow India financial year and opening and closing headcount as follows along with starts, exits, monthly attrition, YTD attrition.
As an example:
For April YTD = Exits in April / Average (opening HC of April, closing HC of April)
For May YTD = Sum of Exits in April & May / Average(closing HC of April, closing HC of May)
For June YTD = Sum of Exits in April, May & June / Average(closing HC of April, closing HC of May, closing HC of June)
and so on till year end
The average headcount that i manually calculated is highlighted in Amber.
How to achieve this in Power Bi using a measure where the average headcount against the months
Below is the .pbix file link and my date relation in Power BI.
https://drive.google.com/file/d/1UrwjF6EP28ZvrKUWKyBix-YisBTR6879/view?usp=drive_link
With the help of this community, I came so far in building the attached dashboard. however, i am not able to figure out how can i get the average headcount measure
I have come across Solved: Re: Average Headcount Calculation - Microsoft Fabric Community but not able to use it in the way I want it.
Can someone help on this
Regards
Sasi
Solved! Go to Solution.
I was able to crack it. Thank for everyone who looked at it.
I was able to crack it. Thank for everyone who looked at it.
Hi @sasi_baddu,
You need a running sum of exits field and a dynamic average of closing headcounts up to the current month.
We can create separate measures for this,
Measure 1 :
YTD_Exits =
CALCULATE(
SUM(YourTable[Exits]),
DATESYTD(YourTable[Date], "03/31") // for April-March Financial Year
)
Measure 2 :
YTD Avg Closing HC =
VAR SelectedMonth = MAX(YourTable[Date])
VAR FilteredHC =
FILTER(
YourTable,
YourTable[Date] <= SelectedMonth
)
RETURN
AVERAGEX(FilteredHC, YourTable[Closing HC])
Measure 3: Let's put these together to get the required values
YTD Attrition =
DIVIDE(
[YTD Exits],
[YTD Avg Closing HC],
BLANK()
)
🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!
Hi @grazitti_sapna ,
I do not have closing headcount in a table rather a measure.
Closing Headcount = Calculate([current employees],LASTDATE('Date'[Date])
Also, in measure 2, YourTable[Date] <= SelectedMonth. YourTable[Date], do i need to select the start date in my data table ? or should i select this from Date table as I am not able to add anything apart from the start date from my data table.
User | Count |
---|---|
84 | |
73 | |
67 | |
42 | |
35 |
User | Count |
---|---|
109 | |
56 | |
52 | |
45 | |
43 |