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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
RobertSparza
Frequent Visitor

How to add overdue weeks to current week data

Hello All,

I've been search a way to fix this but haven't found yet a solution.

 

This tables show the demand for an specific material; however our current Fiscal Week is number 14.
What i want to do is add from Week 10 to 14 demand, to be considered as current demand + Overdue demand, then continue with current demand as is from week 15 and on.

RobertSparza_0-1649014288104.png

 

any clue on how to acheive this?

 

THanks!

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Good morning @RobertSparza 
Here is a sample file with the solution https://www.dropbox.com/t/kukTzQD5LGRnmPBL

I have added a week number column in the same table. Not sure if you are using a date table but the approach would remain the same.

You can create your measure as follows

 

Qty = 
VAR WeekOfToday = 
    WEEKNUM ( TODAY() )
VAR CurrentWeekInFilter =
    SELECTEDVALUE ( Demand[Week Number] )
VAR Result =
    IF (
        CurrentWeekInFilter = WeekOfToday,
        CALCULATE ( 
            SUM ( Demand[Requirement Quantity] ),
            Demand[Week Number] <= WeekOfToday
        ),
        SUM ( Demand[Requirement Quantity] )
    )
RETURN
    Result

 

1.png

Hope this is the result that you're looking for. Have a great day!

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi  @RobertSparza ,

Here are the steps you can follow:

1. Create calculated column.

week = WEEKNUM('Table'[Requirement Date],1)
Flag =
var _current=WEEKNUM(TODAY(),1)
return
IF(
    'Table'[week]<=_current,1,0)

vyangliumsft_0-1649295743639.png

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1649295743639.png

3. Result:

Today is week 15

Before filtering:

vyangliumsft_2-1649295743640.png

After filtering:

vyangliumsft_3-1649295743641.png

 

Please click here for the pbix file

Best Regards,

Liu Yang

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

tamerj1
Super User
Super User

Good morning @RobertSparza 
Here is a sample file with the solution https://www.dropbox.com/t/kukTzQD5LGRnmPBL

I have added a week number column in the same table. Not sure if you are using a date table but the approach would remain the same.

You can create your measure as follows

 

Qty = 
VAR WeekOfToday = 
    WEEKNUM ( TODAY() )
VAR CurrentWeekInFilter =
    SELECTEDVALUE ( Demand[Week Number] )
VAR Result =
    IF (
        CurrentWeekInFilter = WeekOfToday,
        CALCULATE ( 
            SUM ( Demand[Requirement Quantity] ),
            Demand[Week Number] <= WeekOfToday
        ),
        SUM ( Demand[Requirement Quantity] )
    )
RETURN
    Result

 

1.png

Hope this is the result that you're looking for. Have a great day!

tamerj1
Super User
Super User

Hi @RobertSparza 

do want to calculate the running total up to week 14? So week 11 will be the value of week 10 + week 11 and for week 12 will be 10+11+12 and son on? Or you just want only for week 14 to have to total of all previous weeks?  Please provide sample data and the code of your measure. 

Hello Tamej,

I'm chasing to have total of previous weeks in week 14 and as example next week will be all the total of previous in week 15.

Here is the sample data, actually I'm doing like a supply demand for inventory management.

MaterialRequirement DateRequirement Quantity
ABCD3/7/20223,424
ABCD3/7/20229,600
ABCD3/7/20228,560
ABCD3/7/202224,000
ABCD3/8/20224,280
ABCD3/8/202212,000
ABCD3/10/20224,708
ABCD3/10/202213,200
ABCD3/14/202212,840
ABCD3/14/202236,000
ABCD3/14/20228,560
ABCD3/14/202224,000
ABCD3/16/202217,237
ABCD3/16/202248,327
ABCD3/16/202217,120
ABCD3/16/202248,000
ABCD3/17/202217,120
ABCD3/17/202248,000
ABCD3/23/20224,280
ABCD3/23/202212,000
ABCD3/29/202212,840
ABCD3/29/202236,000
ABCD3/30/202213,226
ABCD3/30/202237,080
ABCD3/31/202213,161
ABCD3/31/202236,900
ABCD4/1/202217,463
ABCD4/1/202248,960
ABCD4/5/202213,161
ABCD4/5/202236,900
ABCD4/6/202215,396
ABCD4/6/202243,164
ABCD4/7/202217,548
ABCD4/7/202249,200
ABCD4/7/202224,108
ABCD4/7/20227,704
ABCD4/7/202221,600
ABCD4/8/20224,409
ABCD4/8/202212,360
ABCD4/8/202212,360
ABCD4/8/20228,599

 

The measure I'm trying:

 

Overdue = 
VAR Currentweek = WEEKNUM(TOday(),1)-1
VAR PastDueWeekValue =
    CALCULATE(
    SUMx(resb,RESB[Demand Balance Value]),
    RESB[Fin Week Num] < Currentweek)

RETURN
CALCULATE(
    SUMx(resb,RESB[Demand Balance Value]),
    RESB[Fin Week Num] >= Currentweek
   ) + PastDueWeekValue

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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