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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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