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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BrendanC89
Frequent Visitor

Calculate Moving average by shift by group

Hi, 

 

Trying to work out how to calcuate the moving avereage if the last 3 values in data set by group. 

 

Essentially Calculate the last 3 values in a column. 

 

eg

Group    Value      Shift

1            2             D1

2            4             D1

3            2             D1

1            3             D2

2            3             D2

3            5             D2

1            5             D3

2            0             D3

3            5             D3

 

I Would expect the result to report in D1 

              1           2         3      

D1          3.33      2.33    4

 

 

Any help would be appreciated

 

Thank you

 

1 ACCEPTED SOLUTION

@BrendanC89 

 

You may view the code generated by Quick measure Rolling average.

https://community.powerbi.com/t5/Desktop/I-want-to-get-an-average-of-three-months-from-next-month-to...

Community Support Team _ Sam Zha
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

3 REPLIES 3
CheenuSing
Community Champion
Community Champion

Hi @BrendanC89 ,

 

The table provided is this the final data that you want to derive the moving average.

 

Is there any date in the table ? What are the slicers you will be using to view data ?

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

Hi,

 

thanks for the assistance .

 

My date table could be the "shift" column. which could be set up as Day 1 Night 1 Day 2 night 2 etc or by the following

24/7/19 6AM

24/7/19 6PM

25/7/19 6AM

25/7/19 6PM

etc etc

 

Yes the final table is my desired output and would be best displayed as a table or matrix

 

Hadnt given any thought to using slicers for this.

 

Thank you agian,

 

Brendan

@BrendanC89 

 

You may view the code generated by Quick measure Rolling average.

https://community.powerbi.com/t5/Desktop/I-want-to-get-an-average-of-three-months-from-next-month-to...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.