Forum Discussion
Rolling 3 month calculation
Hello,
i am calculating rolling 3 month annualized turnover, but something is off. My term count for March is 163, when i annualize 163 i get 652. My calculation is only annualzing March and not March and the 2 months prior.
here is my measure - any ideas how i can get it to sum Jan terms, feb terms, march terms and then annualize (X4)?
5 Replies
- selimovdMost Valuable Professional
Hey mmills2018 ,
I think your approach with the date calculation is a little too complicated. Just try to use DATESINPERIOD as a calculate modifier, that seems to be more easy and also more logical for me:
MyMeasure = VAR LatestMonth = LASTDATE( Snapshots[Data as of] ) RETURN CALCULATE( DISTINCTCOUNTNOBLANK( 'Snapshots'[AssociateID] ), 'Snapshots'[Gender] = "Female", 'Snapshots'[Alt Term Date] <> BLANK(), 'Snapshots'[TerminationPrimaryTerminationCategory] = "Voluntary", 'Snapshots'[TerminationBusinessProcessReason] <> "Retirement", 'Snapshots'[TerminationBusinessProcessReason] <> "Assignment/Contract End", 'Snapshots'[TerminationBusinessProcessReason] <> "Deceased", 'Snapshots'[TerminationBusinessProcessReason] <> "Did Not Start", 'Snapshots'[TerminationBusinessProcessReason] <> "Failure to Provide Required Employment Eligibility", DATESINPERIOD( Snapshots[Data as of], LatestMonth, -3, MONTH ) ) * 4I presonally also would "clean up" the TerminationBusinessProcessReason with NOT IN, but that is optional 😉:
MyMeasure = VAR LatestMonth = LASTDATE( Snapshots[Data as of] ) RETURN CALCULATE( DISTINCTCOUNTNOBLANK( 'Snapshots'[AssociateID] ), 'Snapshots'[Gender] = "Female", 'Snapshots'[Alt Term Date] <> BLANK(), 'Snapshots'[TerminationPrimaryTerminationCategory] = "Voluntary", NOT ( 'Snapshots'[TerminationBusinessProcessReason] IN { "Retirement", "Assignment/Contract End", "Deceased", "Did Not Start", "Failure to Provide Required Employment Eligibility" } ), DATESINPERIOD( Snapshots[Data as of], LatestMonth, -3, MONTH ) ) * 4If you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍Best regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic- mmills2018Helper IV
thanks! not sure why but when i do that, it removed my March term count, any ideas why?
- daxer-almightySolution Sage
All the formulae in this thread are incorrect. This is because any time-intel function needs a real date table to work properly. Please read the documentation on DATESINPERIOD: https://dax.guide/datesinperiod
- mmills2018Helper IV
thanks, my initial approach i did use a real data table, below is my measure:
VAR LatestMonth = LASTDATE('Date Table'[Date])VAR Prior3rdMonth = FIRSTDATE(DATESINPERIOD(Snapshots[Data as of],LatestMonth,-3,month) )returnCALCULATE(DISTINCTCOUNTNOBLANK( 'Snapshots'[AssociateID] ),'Snapshots'[Gender] = "Female",'Snapshots'[Alt Term Date] <> BLANK(),'Snapshots'[TerminationPrimaryTerminationCategory] = "Voluntary",'Snapshots'[TerminationBusinessProcessReason] <> "Retirement",'Snapshots'[TerminationBusinessProcessReason] <> "Assignment/Contract End",'Snapshots'[TerminationBusinessProcessReason] <> "Deceased",'Snapshots'[TerminationBusinessProcessReason] <> "Did Not Start",'Snapshots'[TerminationBusinessProcessReason] <> "Failure to Provide Required Employment Eligibility",DATESINPERIOD('Date Table'[Date],LatestMonth,-3,MONTH)) * 4and this is what i return. The issue i am having is i want to calculate rolling 3 month annualized turnover by month, so for March i should see 1628, it is also only showing me 3 months of data, i want to see a years worth of data, so Feb would include Dec, Jan and Feb terms, but i need a moving rolling count. any ideas on how to do this?
- AnonymousNot applicable
Hi mmills2018 ,
Based on your description, the DAX formula you created does not seem to see any logical problems.
Could you please share some sample data and the expected result to have a clear understanding of your question? I can do some tests for you. 😊 If the information is sensitive please share it after removing private message.
You can save your files in some cloud sharing platforms and share the link here.
How to provide sample data in the Power BI Forum - Microsoft Power BI Community
Best Regards,
Yuna