Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
I have been tryiong to develop a measure that will calculate the avgFTE over a selected period of time, but have not been able to get it to calculate correctly. The code I have works for months Feb-Dec and Q2-Q4, but does not work for Jan, Q1 or Full year averages where the calculation has to span to the prior year. The logic for calculating avg FTE for a specific month is the average of the ending FTE for that month and the prior month. For the qtr it is the average of the ending FTEs for the 3 months of the selected qtr and the last month of the prior qtr. And for full year it is the average of the ending FTE for each month of the selected year and Dec of the prior year.
Below is the code I have written as well as a snippet from my dashboard. Can anyone help in fixing this code or writing a new code that would work for this calculation?
Avg_FTE =
Solved! Go to Solution.
Hi @psstack,
Thank you @BeaBF,@FBergamaschi, for your insights.
I’ve reproduced your issue using sample data and confirmed the behavior. The measures are returning the expected results Ending FTE provides the final available value for the period, whereas Avg FTE Month/Quarter/Year shows the appropriate aggregation for each respective level. Ending FTE gives the last available value in the period, while the Avg FTE Month/Quarter/Year reflect the correct aggregation at each level.
Hope this helps
Thank you.
Hi @psstack,
We haven’t heard back from you in a while regarding your issue. let us know if your issue has been resolved or if you still require support.
Thank you.
Hi @psstack,
Checking in to see if your issue has been resolved. let us know if you still need any assistance.
Thank you.
Hi @psstack,
Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.
Thank you.
Hi @psstack,
Thank you @BeaBF,@FBergamaschi, for your insights.
I’ve reproduced your issue using sample data and confirmed the behavior. The measures are returning the expected results Ending FTE provides the final available value for the period, whereas Avg FTE Month/Quarter/Year shows the appropriate aggregation for each respective level. Ending FTE gives the last available value in the period, while the Avg FTE Month/Quarter/Year reflect the correct aggregation at each level.
Hope this helps
Thank you.
@psstack Hi! Try with:
Avg_FTE =
VAR CurrDate = MAX ( Periods[Period (dt)] )
VAR CurrYear = YEAR ( CurrDate )
VAR CurrMonth = MONTH ( CurrDate )
-- Current period FTE (month, quarter, or year context)
VAR CurrFTEs =
CALCULATE ( [FTEs], KEEPFILTERS ( Periods[Period (dt)] ) )
-- Prior month FTE (for Jan, will go to Dec prior year)
VAR PrevMonthFTE =
CALCULATE (
[FTEs],
DATEADD ( Periods[Period (dt)], -1, MONTH )
)
-- Prior quarter last month FTE (for Q1, this will go to Dec prior year)
VAR PrevQtrFTE =
CALCULATE (
[FTEs],
DATEADD ( Periods[Period (dt)], -1, QUARTER )
)
-- Prior year Dec FTE (for Full Year averages)
VAR PrevYearEndFTE =
CALCULATE (
[FTEs],
FILTER ( ALL ( Periods ), Periods[Year] = CurrYear - 1 && Periods[Month Name] = "Dec" )
)
-- Average logic
RETURN
SWITCH (
TRUE(),
-- If at Month granularity
HASONEVALUE ( Periods[Month Name] ),
DIVIDE ( PrevMonthFTE + CurrFTEs, 2 ),
-- If at Quarter granularity
HASONEVALUE ( Periods[Qtr] ),
DIVIDE ( PrevQtrFTE + SUMX ( VALUES ( Periods[Month Name] ), [FTEs] ), 4 ),
-- If at Year granularity
HASONEVALUE ( Periods[Year] ),
DIVIDE ( PrevYearEndFTE + SUMX ( VALUES ( Periods[Month Name] ), [FTEs] ), 13 )
)
BBF
Please include, in a usable format, not an image, a small set of rows for each of the tables involved in your request and show the data model in a picture, so that we can import the tables in Power BI and reproduce the data model. The subset of rows you provide, even is just a subset of the original tables, must cover your issue or question completely. Do not include sensitive information and do not include anything that is unrelated to the issue or question. Please show the expected outcome based on the sample data you provided and make sure, in case you show a Power BI visual, to clarify the columns used in the grouping sections of the visual.
Need help uploading data? click here
Want faster answers? click here
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 31 | |
| 31 | |
| 20 | |
| 12 | |
| 12 |