Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi all, I'm looking for assistance building a Custom Column. I have an appended report feeding into PowerBI that tracks our annual headcount as of Jan-1 of each year by Associate ID. If an associate is active with us for multiple years, they will return multiple rows, each under its own year and row index.
My question is how can I create a Custom Column to accomplish the following:
IF 'Associate ID' value repeats from one Headcount Year to the next, return "Retained"
IF 'Associate ID' value does NOT repeat from one Headcount Year to the next, return "Terminated"
IF 'Headcount Year' = 2025 (or current year), return "Not Applicable" as retention to the next year cannot be calculated yet.
Here is an example of what my table looks like. The Column D in Red is what I am trying to produce.
Table: Annual Headcount
Row/Index | Column A | Column B | Column C | Column D |
1 | Headcount Year | Next Headcount Year | Associate ID | Retained to Next Year? |
2 | 2023 | 2024 | 1001 | Retained |
3 | 2024 | 2025 | 1001 | Retained |
4 | 2025 | 2026 | 1001 | Not Applicable |
5 | 2023 | 2024 | 1002 | Retained |
6 | 2024 | 2025 | 1002 | Terminated |
7 | 2023 | 2021 | 1003 | Terminated |
Other Notes:
Thanks!
Hi @Elaina0907 ,
You can create a calculated column as below to get it, please find the details in the attachment.
Retained to Next Year? =
VAR _aid = 'Table'[Associate ID]
VAR _hcyear = 'Table'[Headcount Year]
VAR _next =
CALCULATE (
MAX ( 'Table'[Associate ID] ),
FILTER (
'Table',
'Table'[Associate ID] = _aid
&& 'Table'[Headcount Year] = _hcyear + 1
)
)
RETURN
IF (
NOT ( ISBLANK ( _next ) ),
"Retained",
IF ( _hcyear IN { 2025, YEAR ( TODAY () ) }, "Not Applicable", "Terminated" )
)
Best Regards
you can try this
Proud to be a Super User!
@Elaina0907 , You try out approch like
Customer Retention with Dynamic Segmentation, New/Lost/Retain Customer Count: https://youtu.be/EyL7KMw877Q
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
85 | |
78 | |
53 | |
38 | |
36 |
User | Count |
---|---|
100 | |
85 | |
47 | |
45 | |
44 |