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
mmills2018
Helper IV
Helper IV

Rolling 3 month calculation

Hello,

 

i have the below measure that functions correctly for rolling 3 month turnover.  The issue I am having is that if an associate terms at the end of a month, they are counting in that months headcount because there term would be effective the following month.  So, if i termed on 3/31/2021, i would be included in March's headcount and counted as a term in April.  For my term count, in my measure  I have: VAR LatestMonth = LASTDATE('Date Table'[Full Date]), so, its taking the end of the month terms.  any way i can set it up to say something like; LASTDATE('Date Table'[Full Date]-1day)?

 

 

Involuntary US Black Turnover =
VAR LatestMonth = LASTDATE('Date Table'[Full Date])
VAR Prior3rdMonth = FIRSTDATE(DATESINPERIOD('Date Table'[Full Date],LatestMonth,-4,month) )


return
CALCULATE(
DISTINCTCOUNTNOBLANK( 'Snapshots'[AssociateID] ),
'Snapshots'[Race_Ethnicity] = "Black Or African American (United States of America)",
'Snapshots'[Alt Term Date] <> BLANK(),
'Snapshots'[TerminationPrimaryTerminationCategory] = "Involuntary",
DATESINPERIOD(
'Date Table'[Full Date],
LatestMonth,
-3,
MONTH
)
) *4
/

((CALCULATE(DISTINCTCOUNTNOBLANK('Snapshots'[AssociateID]),'Snapshots'[Race_Ethnicity]="Black Or African American (United States of America)",'Snapshots'[Part of Month End Headcount?]="Yes",Prior3rdMonth)+CALCULATE(DISTINCTCOUNTNOBLANK('Snapshots'[AssociateID]),'Snapshots'[Race_Ethnicity]="Black Or African American (United States of America)",'Snapshots'[Part of Month End Headcount?]="Yes",LASTDATE('Snapshots'[Data as of])))/2)+0
3 REPLIES 3
lbendlin
Super User
Super User

maybe provide some sample data and show the expected outcome.  Likely you will need to protect the LASTDATE() with a CALCULATE() and a filter.

lbendlin
Super User
Super User

LASTDATE('Date Table'[Full Date])-1

I tried that but it excludes from all eom headcount, I want to include month end terms from my datesinperiod timefreame.  So, for rolling 3 month, I want to exclude those who termed 3/31/2021 but include 2/28 and 1/31.

DATESINPERIOD(
'Date Table'[Full Date],
LatestMonth,
-3,
MONTH
)
) *4
/

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.