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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Junminkim0214
Frequent Visitor

Weekly sales average over X number of weeks based on Current Week - 4 weeks

Hello Power BI expert heroes!

 

I'm trying to calcuate weekly consumer sales average over 4 weeks based on the table format below (My table have month and week only, but not date)

 

Could you please let me know how I can get the results? 

 

Calendar MonthCalendar WeekConsumer Sales
Jan150
Jan260
Jan380
Jan450
Feb570
Feb650
Feb748
Feb830
Mar940
Mar1046
Mar1190
Mar1272
Mar1376

 

@amitchandak @parry2k 

1 ACCEPTED SOLUTION

@Junminkim0214 based on your data, the solution is attached, tweak it as per your need. I created few measures to showcase how it works but you can collapse all these in one (if you want)

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos 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.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@Junminkim0214 year? What happens if there are two years of data, month and week will repeat? How you will find out which year it is and go back 4 weeks?



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.

Hi @parry2k ,

 

First, SUPER Thanks for your help! I pasted the same measures to my woring file, and it works now. 👍👍

 

Regardng year, yes you're right. How do we need to calculate 'Ave Last 4 Weeks' especially for 2020 early Jan which required LY 2019 Dec Weeks? 

 

Calendar YearCalendar MonthCalendar WeekConsumer Sales
2019Dec4880
2019Dec4950
2019Dec5070
2019Dec5150
2019Dec5248
2020Jan150
2020Jan260
2020Jan380
2020Jan450
2020Feb570
2020Feb650
2020Feb748
2020Feb830
2020Mar940
2020Mar1046
2020Mar1190
2020Mar1272
2020Mar1376

@Junminkim0214 , I am hopeful, you have already got solution from @parry2k  post. My approch is using Rank. In that you need a numeric month. 

Year-Month-Week 

2019-01-01

 

You can refer 

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...

 

As I have nor seen Parry's Solution, my be repeated what he has suggested. 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@Junminkim0214 based on your data, the solution is attached, tweak it as per your need. I created few measures to showcase how it works but you can collapse all these in one (if you want)

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos 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.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.