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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.