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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
billuran2009
Helper I
Helper I

Rolling Average of Measure

HI I need to do rolling average of a measure called Enrollment:

Enrollment = CALCULATE(COUNTx(FILTER(PatientDetails,PatientDetails[Admit Date]<=min('DateTable'[Date]) && (ISBLANK(PatientDetails[DisDate]) || PatientDetails[DisDate]>min('DateTable'[Date]))),(PatientDetails[ACCOUNT NUMBER])),CROSSFILTER(PatientDetails[Admit Date],'DateTable'[Date],None))
 
Basically takes the active patients at the beginning of the month and I show it by month. 
How can I show the last 6 month average of the above measure? I have a date field called moyear 1/1/2022 to use aswell.
 
 
 
3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @billuran2009 ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file without sensitive data.


Best Regards,

Rico Zhou

v-rzhou-msft
Community Support
Community Support

Hi @billuran2009 ,

 

According to your statement I know that you want to calculate last 6 month rolling average based on [Enrollment].

My Sample:

1.png

Try this code.

Last 6 Month Rolling Average of Enrollment = 
AVERAGEX (
    DATESINPERIOD ( 'Date'[Date], MIN ( 'Date'[Date] ), -6, MONTH ),
    [Enrollment]
)

Your measure is complex that it will use relationships and filter based on different tables. If this reply still couldn't help you solve your problem, please share a sample file without sensitive data with us and show us a screenshot with the result you want. This will make us easier to solve your problem.

 

Best Regards,
Rico Zhou

 

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

parry2k
Super User
Super User

@billuran2009 not sure if you saw this article, it will help answer your question Rolling 12 Months Average in DAX - SQLBI

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.