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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
naoyixue1
Post Patron
Post Patron

How to calculate next 4 weeks demands (not standard calendar, but the combo of week such as 2022001)

Hey all,

 

I try to calculate next 4 weeks demands. But it doesn't depend on the standardized calendar but on the combo of year and week, such as 2022001 1st week of year 2022). For example, in week 1 2022, (2022001), my next 4 weeks demands should cover from 2022002 thru 2022005. 

 

naoyixue1_0-1646703189190.png

 

I initially set up as below, but that doesn't work for me. Any thoughts? Thanks!

 

naoyixue1_1-1646707828546.png

 

 

 

 

1 ACCEPTED SOLUTION

Hi @naoyixue1 

 

If you only use "[YearAnd Week]<=CurrentYearAndWeek+4" then the formula will consider all weeks before CurrentYearAndWeek+4 which is more than 4 weeks, to make it correct and keep it in the exact period you need to cap the lowest amount and highest amount.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

4 REPLIES 4
VahidDM
Super User
Super User

HI @naoyixue1 

 

In your dax formula, in the filter try to write something like below:

 

Filter(all(table),[YearAnd Week]>=CurrentYearAndWeek&&[YearAnd Week]<=CurrentYearAndWeek+4)

 

rather that SELECTEDVVALUE you can use MAX.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

@VahidDM Thanks!

@VahidDM  

 

Hey Vahid,

 

Thanks for your help. I still see there is off for some calculation. But I think your logic is right. Would you mind explaining the login for below dax.  Is that ok for me to only put "[YearAnd Week]<=CurrentYearAndWeek+4" In other words, why should we put "[YearAnd Week]>=CurrentYearAndWeek"?  Thanks!

 

Filter(all(table),[YearAnd Week]>=CurrentYearAndWeek&&[YearAnd Week]<=CurrentYearAndWeek+4)

Hi @naoyixue1 

 

If you only use "[YearAnd Week]<=CurrentYearAndWeek+4" then the formula will consider all weeks before CurrentYearAndWeek+4 which is more than 4 weeks, to make it correct and keep it in the exact period you need to cap the lowest amount and highest amount.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.