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
bryanang
Frequent Visitor

How to Calculate Rolling Average?

I have a dataset with a date column, column called "column" (every value is 1 for simplicity), and a measure for rolling average.

 

Rolling average =
CALCULATE(
   SUM(
       vw_BI_Yield_Trend[Column]),
    DATESINPERIOD(vw_BI_Yield_Trend[MFG_SYN_OUT_DATE], MAX(vw_BI_Yield_Trend[MFG_SYN_OUT_DATE]), -3, DAY))
 
The formula seems to work initially but as i scroll from 2006 to 2023 data, I notice the summation does not tabulate right.
bryanang_1-1687487328582.png

 


 

10 REPLIES 10
bryanang
Frequent Visitor

Hi Ashish Mathur, I've tried the above mentioned, the outcome still looks pretty much unchanged unfortunately

bryanang_0-1687488694204.png

 

Share the download link of the PBI file and shwo the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

That takes me to a sign-in page.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Seems like I cannot share with you because you're outside of the organisation, im sorry. But it seems like the issue could be because I have duplicate rows in my date. (Have filtered it down in the data view tab but didn't know that the filter gets stripped off in the report view)

Yeap its uploaded to the power bi service, would need you to log in with an account.

I obviously cannot log in there.  Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I get a sign-in page.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Try this approach:

  1. Create a Calendar Table
  2. Create a relationship (Many to One and Single) from the Date column of the Data Table to the Date column of the Calendar Table
  3. To your visual, drag the Date column from the Calendar Table
  4. Write these measures

Total = SUM(vw_BI_Yield_Trend[Column])

Measure = calculate([Total],datesbetween(calendar[date],min(calendar[date])-2,min(calendar[date])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.