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

FTE change month over month

Dear,

 

I have been able to put together measure to calculate average FTEs per month and to compare evolution of FTEs month over month on totals level. However, when adding a row context such as service line, I'm struggling to modify my formula in such a way that it would work.

 

My data looks like this (period = month number):

Service LineSub Service LineYearPeriodFTE
AX2020910
AY2020915
AY20201020
BR2020911
BS2020917
BS20201024

 

My current measures:

Previous Month FTE =
VAR CurrentMonth = selectedvalue( 'Rap+Performance'[Period])
VAR CurrentYear = selectedvalue( 'Rap+Performance'[Year])
VAR MaxMonthNum = calculate(max('Rap+Performance'[Period]), all('Rap+Performance'))
RETURN
IF (hasonevalue('Rap+Performance'[Period]),
sumx( filter (all ( 'Rap+Performance'), if ( CurrentMonth = 1, 'Rap+Performance'[Period] = MaxMonthNum && 'Rap+Performance'[Year] = CurrentYear - 1,
'Rap+Performance'[Period] = CurrentMonth - 1 && 'Rap+Performance'[Year] = CurrentYear)),
[FTE ]), blank())
 
Current Month FTE =
VAR CurrentMonth = selectedvalue( 'Rap+Performance'[Period])
VAR CurrentYear = selectedvalue( 'Rap+Performance'[Year])
VAR MaxMonthNum = calculate(max('Rap+Performance'[Period]), all('Rap+Performance'))
RETURN
IF (hasonevalue('Rap+Performance'[Period]),
sumx( filter (all ( 'Rap+Performance'), if ( CurrentMonth = 1, 'Rap+Performance'[Period] = MaxMonthNum && 'Rap+Performance'[Year] = CurrentYear,
'Rap+Performance'[Period] = CurrentMonth && 'Rap+Performance'[Year] = CurrentYear)),
[FTE ]), blank())
 
FTE change month over month = if (isblank([Previous Month FTE]), blank(), [Current Month FTE] - [Previous Month FTE])
 
However, these measures result in a table looking like this when selecting a certain period via a slicer:
Service LineSub SLPrevious Month FTECurrent Month FTEFTE change month over month
AX5344-9
AY5344-9
BR5344-9
BS5344-9
Total 5344-9

 

The totals in the above table are correct. However, I would like to see the FTEs shown correctly per Service Line and Sub Service Line, while now all the rows only show the total value ignoring this row context. Can anyone help me to modify my formulas to make this work?

 

Thank you!

1 ACCEPTED SOLUTION

Hi @Anonymous ,

You can update the formula of measure [Current Month FTE] and [Previous Month FTE] as below:

Current Month FTE = CALCULATE(SUM('Rap+Performance'[FTE]))
Previous Month FTE = 
VAR CurrentMonth = SELECTEDVALUE( 'Rap+Performance'[Period])
VAR CurrentYear = SELECTEDVALUE( 'Rap+Performance'[Year])
VAR MaxMonthNum = calculate(max('Rap+Performance'[Period]), all('Rap+Performance'))
RETURN
IF (hasonevalue('Rap+Performance'[Period]),
sumx( filter (all ( 'Rap+Performance'), if ( CurrentMonth = 1, 'Rap+Performance'[Period] = MaxMonthNum && 'Rap+Performance'[Year] = CurrentYear - 1,
'Rap+Performance'[Period] = CurrentMonth - 1 && 'Rap+Performance'[Year] = CurrentYear)
&&'Rap+Performance'[Service Line]=MAX('Rap+Performance'[Service Line])&&'Rap+Performance'[Sub Service Line]=MAX('Rap+Performance'[Sub Service Line])),
[FTE]), blank())

FTE change month over month.JPG

Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , You can create a date using year and period

 

Date = date([year], [period],1)

Then you can  use Time intelligence with date table

 

examples

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
this month =MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
previous month value =  CALCULATE(sum(''Table''[total hours value]),previousmonth('Date'[Date]))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Anonymous
Not applicable

Dear @amitchandak , Thank you for your response! However, I don't need any year to date figures as this is about FTEs and the month over month evolution, not about sales. As mentioned, my formulas are working fine upon selecting periods so there are no issues with my dates. The only issue is to get the formula working to show the value per service line instead of per total - do you know how to modify my formula to ensure a value per row context / service line is shown?

Hi @Anonymous ,

You can update the formula of measure [Current Month FTE] and [Previous Month FTE] as below:

Current Month FTE = CALCULATE(SUM('Rap+Performance'[FTE]))
Previous Month FTE = 
VAR CurrentMonth = SELECTEDVALUE( 'Rap+Performance'[Period])
VAR CurrentYear = SELECTEDVALUE( 'Rap+Performance'[Year])
VAR MaxMonthNum = calculate(max('Rap+Performance'[Period]), all('Rap+Performance'))
RETURN
IF (hasonevalue('Rap+Performance'[Period]),
sumx( filter (all ( 'Rap+Performance'), if ( CurrentMonth = 1, 'Rap+Performance'[Period] = MaxMonthNum && 'Rap+Performance'[Year] = CurrentYear - 1,
'Rap+Performance'[Period] = CurrentMonth - 1 && 'Rap+Performance'[Year] = CurrentYear)
&&'Rap+Performance'[Service Line]=MAX('Rap+Performance'[Service Line])&&'Rap+Performance'[Sub Service Line]=MAX('Rap+Performance'[Sub Service Line])),
[FTE]), blank())

FTE change month over month.JPG

Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.