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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jwatt
Frequent Visitor

HR Headcount by Effective Date and Status

Hello!

 

I am trying to create a line graph to show our organization's FTE count over time. I assume I need some sort of measure to do this but so far any solutions I have found online and tried myself have not quite worked. I also need it to be more granular than just by month or year. 

 

My data includes multiple records per employee for whenever their status changes and HR enters the date it is effective.

 

I would like it to show over time the number of employees at each status. So one line each for Active, Terminated, Leave with Pay, Parental Leave, Retired. 

 

Here is an example of my dataset: 

IDEff_Datec_StatusFTE
13007/1/2015Active1
13001/22/2021Leave with Pay1
13005/1/2021Retired1
30129/8/2020Active0.5
30126/16/2021Terminated0.5
86146/1/2015Active1
04077/1/2022Active0.75
04073/26/2023LTD0.75

 

I have actually been able to get this to work in a table visual using the following measure but it doesn't work in the line graph. 

Total FTE As At Selected Date = 
VAR SelectedDate =
    MAX ( 'DateTable'[Date] )
RETURN
SUMX (
    VALUES ( 'All'[ID] ),
    VAR LatestEffdt =
        CALCULATE (
            MAX ( 'All'[Eff_Date] ),
            FILTER (
                ALL ( 'All' ),
                'All'[ID] = EARLIER ( 'All'[ID] )
                    && 'All'[Eff_Date] <= SelectedDate
            )
        )
    RETURN
        CALCULATE (
            MAX ( 'All'[FTE] ),
            FILTER (
                'All',
                'All'[ID] = EARLIER ( 'All'[ID] )
                    && 'All'[Eff_Date] = LatestEffdt
            )
        )

 

I hope I have presented this clearly.  I have only recently started to use Power Bi for anything other than very simple visuals so any help or advice is greatly appreciated!

1 ACCEPTED SOLUTION

hello @jwatt 

 

using your sample pbix, i can find the value using the exact same DAX.

however, you need to have a ID selection because of same ID DAX.

Irwan_0-1758759673649.png

Latest Date =
CALCULATE(
    MAX('All'[Eff_Date]),
    FILTER(
        ALL('All'),
        'All'[ID ]=SELECTEDVALUE('All'[ID ])&&
        'All'[Eff_Date]<=MAX('All'[Eff_Date])
    )
)
Total FTE =
CALCULATE(
    MAX('All'[FTE]),
    FILTER(
        'All',
        'All'[ID ]=SELECTEDVALUE('All'[ID ])&&
        'All'[Eff_Date]=[Latest Date]
    )
)

 

if you will provide ID slicer, then you can remove that line since slicer selection will do the same as finding same ID.

Then you can have a line chart even without an ID selection. However, the value will be shown is max value of FTE.

Irwan_1-1758759882104.png

Latest Date =
CALCULATE(
    MAX('All'[Eff_Date]),
    FILTER(
        ALL('All'),
        'All'[Eff_Date]<=MAX('All'[Eff_Date])
    )
)
Total FTE =
CALCULATE(
    MAX('All'[FTE]),
    FILTER(
        'All',
        'All'[Eff_Date]=[Latest Date]
    )
)

Hope this will help.
Thank you.

 

View solution in original post

9 REPLIES 9
v-sdhruv
Community Support
Community Support

Hi @jwatt ,
Since we didnt hear back, we would be closing this thread.
If you need any assistance, feel free to reach out by creating a new post.

Thank you for using Microsoft Community Forum

v-sdhruv
Community Support
Community Support

Hi @jwatt ,
I hope the information provided above assists you in resolving the issue. If you have any additional questions, please feel free to reach out.
Thank You

v-sdhruv
Community Support
Community Support

Hi @jwatt ,
I hope the information provided above assists you in resolving the issue. If you have any additional questions, please feel free to reach out.We would be  happy to help with any further assistance you may need.
Thank You

Irwan
Super User
Super User

hello @jwatt 

 

looking at your DAX, are you trying to find max FTE at latest date?

 

i might be misunderstood but please check if this accomodate your need.

Irwan_0-1758236567876.png

create two measure for [Latest Date] and [Total FTE]

Latest Date =
CALCULATE(
    MAX('Table'[Eff_Date]),
    FILTER(
        ALL('Table'),
        'Table'[ID]=SELECTEDVALUE('Table'[ID])&&
        'Table'[Eff_Date]<=MAX('Table'[Eff_Date])
    )
)
Total FTE =
CALCULATE(
    MAX('Table'[FTE]),
    FILTER(
        ALL('Table'),
        'Table'[ID]=SELECTEDVALUE('Table'[ID])&&
        'Table'[Eff_Date]=[Latest Date]
    )
)
 
another thing, i assumed your DAX is a form of measure hence EARLIER does not work on measure. This probably cause your measure doesnt work. EARLIER can be used in calculated column so you might want to try in calculated column with EARLIER.
 
Hope this will help.
Thank you.
jwatt
Frequent Visitor

Hi @Irwan 

 

Thanks for taking the time to look at this! 

 

For my data below, I could have explained better. Employee 1300 below for instance, is a full time employee (1 FTE) who was active on 7/1/2015 and went to leave with pay status on 1/22/2021 and then retired 5/1/2021. Also, I noticed you had ID 3012 as 5 and 0407 as 75 - not sure if it matters for the calculations you suggested but these are single employees who are part time so they are 0.5 and 0.75 FTE. 

 

We have many more employees than this since this is just a snippet. I have thousands of lines showing changes in c_Status over years.  What I would like to have it do is over time show how many employees are at each status. So for Leave with Pay, if in 2021 there was 1 ID with this status but then 2022 there were 4 and in 2023 there were 2 there would be a line representing this in the graph, along with separate lines for active, Parental Leave, etc. 

 

IDEff_Datec_StatusFTE
13007/1/2015Active1
13001/22/2021Leave with Pay1
13005/1/2021Retired1
30129/8/2020Active0.5
30126/16/2021Terminated0.5
86146/1/2015Active1
04077/1/2022Active0.75
04073/26/2023LTD0.75

 

I did try to use your measures - my table name is "All."

Latest Date = 
CALCULATE(
    MAX('All'[Eff_Date]),
    FILTER(
        ALL('All'),
        'All'[ID]=SELECTEDVALUE('All'[ID])&&
        'All'[Eff_Date]<=MAX('All'[Dept_ID])
    )
)

 

Total FTE = 
CALCULATE(
    MAX('All'[FTE]),
    FILTER(
        ALL('All'),
        'All'[ID]=SELECTEDVALUE('All'[FTE])&&
        'All'[Eff_Date]=[Latest Date]
    )
)

 

When I added these to a line graph the same as in the pbix you provided, the graph just shows as blank. 

 

image.png

 

The DAX I provided in my original post has actually worked for a table visual. I had forgotten to copy it in but I did in fact have a measure similar to your Latest Date. Trying to use the measure in the line graph does not work because it creates different points for each effective date - for example if one person was hired on May 16, 2025 then the graph shows 1 person for that date where I need it to show the total number active on that date. 

 

Something like this - 

 

image.png

Please let me know if you have any further advice. 

 

Thank you!

hello @jwatt 


what is FTE role in your headcount?

 

if you are looking count of employee with certain status, i think you can directly use line chart then put c_Status as legend and distinct count of employee ID.

Irwan_0-1758240018388.png

 

or do you want only to see the latest c_Status of each ID?

 

Thank you.

jwatt
Frequent Visitor

Hi @Irwan 

 

The total FTE at each c_Status is what I would like to see by date rather than count of employee. The graph you provided for the Total FTE by Eff_Date is what I want but split out by c_Status - which I can do by adding c_Status to the legend. 

 

Unfortunately when I use the measures you provided in my own file it does not seem to work. 

 

In my previous reply, I provided the measures as written in my project with the actual table name I am using ("All") and provided a screenshot showing that the graph shows no information. 

 

Do you see any issue with how I have copied your measures over and replacing the table name with "All"? Or do you have any further ideas on why it might not be working for me? I have replicated your file but just with changing the table name so I am not sure why the graph wouldn't show anything.

 

Thanks very much!

hello @jwatt 

 

i dont see any problem with your DAX.
Replacing table name with "ALL" should be any problem as far as i know.

however if you suspect on that table name, try changing the name and see if it makes any difference.

 

the blank value means the measures couldnt find any value. surely there is an issue that prevent the measure to work but kinda hard to imagine the issue from description.

Irwan_0-1758668841285.png


can you share your pbix? upload it in dropbox or googledrive then open access permission.

 

remove any confidential information.

if you have doubt put your file in public post, you can send private message for the dropbox link.

 

Thank you.

hello @jwatt 

 

using your sample pbix, i can find the value using the exact same DAX.

however, you need to have a ID selection because of same ID DAX.

Irwan_0-1758759673649.png

Latest Date =
CALCULATE(
    MAX('All'[Eff_Date]),
    FILTER(
        ALL('All'),
        'All'[ID ]=SELECTEDVALUE('All'[ID ])&&
        'All'[Eff_Date]<=MAX('All'[Eff_Date])
    )
)
Total FTE =
CALCULATE(
    MAX('All'[FTE]),
    FILTER(
        'All',
        'All'[ID ]=SELECTEDVALUE('All'[ID ])&&
        'All'[Eff_Date]=[Latest Date]
    )
)

 

if you will provide ID slicer, then you can remove that line since slicer selection will do the same as finding same ID.

Then you can have a line chart even without an ID selection. However, the value will be shown is max value of FTE.

Irwan_1-1758759882104.png

Latest Date =
CALCULATE(
    MAX('All'[Eff_Date]),
    FILTER(
        ALL('All'),
        'All'[Eff_Date]<=MAX('All'[Eff_Date])
    )
)
Total FTE =
CALCULATE(
    MAX('All'[FTE]),
    FILTER(
        'All',
        'All'[Eff_Date]=[Latest Date]
    )
)

Hope this will help.
Thank you.

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.