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
gany
New Member

3 month rolling average in POWERQUERY as Custom Column

Hi guys

 

I have this table created by transformation->grouping + merging fields from other table 

 

I need to create aditional column with rolling 3 month calculation in POWER QUERY by adding Custom Column

example : For Jan 2022 (Jan 22+Dec21+Nov21)/3 =(6.44+9.18+6.45)/3=7.36 

                 For Dec 2021 (Dec21+Nov21+Oct21)/3 =(9.18+6.45+2.07)/3=5.9

 

This table name : PREMIUM WORKFLOW( 1)  TableTable

Can anyone pls help ?

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @gany ,

Please have a try.

 

(x)=>
List.Average(Table.SelectRows(#"Renamed Columns", (row)=>List.Contains(List.MaxN(List.Select(#"Renamed Columns"[Period], (y)=>y<=x[Period]),3), row[Period]))[Value])

 

vpollymsft_0-1643351817589.png

Best Regards

Community Support Team _ Polly

 

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

8 REPLIES 8
v-rongtiep-msft
Community Support
Community Support

Hi @gany ,

Please have a try.

 

(x)=>
List.Average(Table.SelectRows(#"Renamed Columns", (row)=>List.Contains(List.MaxN(List.Select(#"Renamed Columns"[Period], (y)=>y<=x[Period]),3), row[Period]))[Value])

 

vpollymsft_0-1643351817589.png

Best Regards

Community Support Team _ Polly

 

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

 

 

Amazing, thanks a lot

parry2k
Super User
Super User

@gany I see, I don't have a handy solution for that and I'm not sure if I'm going to spend time to make it happen. I hope someone else can help. Good luck!



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.

Ok, thanks anyway

parry2k
Super User
Super User

@gany not sure what to say. What have you tried? Are you getting errors or wrong results? Can you share more details?



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.

I'm trying to add this as a custom column withing power query .

 

I got it working as a measure but that is not what i need, i need to expand table by aditional column (in power query)

parry2k
Super User
Super User

@gany there are so many articles on it, here is link to one 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.

Thanks for the reply...i saw that one ...still dont understand the logic and was not able to use it.

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.