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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Rolling 12 Month Counts

I need to calculate rolling average in a little different way:

Step1 Get the active employee counts 12 month back i.e; 6/1/2019 counts as of today 

Step 2 Get active employee counts previous month i.e, 5/1/2020 counts as of today

Step 3 Add then get average of those 2 counts.

 

The date sample and example: Counts of Previous Month(5/1/2020) is 2 and counts of 12 Month back(6/1/2019) is 3.

the average is 2.5

DateRan IDLocation
5/1/2020101ABC
5/1/2020102DEF
4/1/2020101ABC
4/1/2020102DEF
6/1/2019101AAA
6/1//2019103WWW
6/1/2019105EEE

The date is captured every first of the month and I have data every month

Here is formula I tried

Count of Active Employee =
VAR endOfPeriod =EOMONTH(TODAY(),-13)+1

VAR startOfPeriod = EOMONTH(TODAY(),-2)+1
RETURN
CALCULATE (
COUNTROWS('ActiveEmp'), FILTER(ALL('ActiveEmp'), ('ActiveEmp'[DateRan].[Date] =startOfPeriod && 'ActiveEmp'[DateRan].[Date]=endOfPeriod)))
Any help is really appreciated! Thank you
1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

"Step1 Get the active employee counts 12 month back", did you mean the duration is  2018/6/1-2019/6/1? If so , you could try to refer to my sample for details.

Best Regards,
Zoe Zhi

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

2 REPLIES 2
dax
Community Support
Community Support

Hi @Anonymous , 

"Step1 Get the active employee counts 12 month back", did you mean the duration is  2018/6/1-2019/6/1? If so , you could try to refer to my sample for details.

Best Regards,
Zoe Zhi

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

 

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

To get previous year count use SAMEPERIODLASTYEAR
https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

 

For previous Month you can use PARALLELPERIOD

https://docs.microsoft.com/en-us/dax/parallelperiod-function-dax

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.