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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sajal161292
Helper V
Helper V

need to extend the quantities across all dates

Hi,

 

I am working on a visual in Power BI in which I woould like to copy the previous week's quantity to the next week if it does not exists and keep the same values if it exists.

 

short_xls4.png

As an example in the 1st row there is no quantity against the dates 2/26/2018 and 2/27/2018...so it should be previous week's value(0 11359 11359) etc.. 

 short_xls5.png

 

Need to create  a DAX measure for this functionality.

So could you please tell me a way of achieving it in Power BI?

5 REPLIES 5
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @sajal161292,

 

Please share a dummy sample. We can't write a DAX formula without data and its structure. Maybe you can try the function LASTNONBLANK

There will be many questions without data.

1. Are all the columns from the same table?

2. Are the values from a table or from calculations?

3. What are the relationships?

 

Best Regards,

Dale

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

Hi,

 

Please find the link of my file below:

https://drive.google.com/open?id=1cCnbdHqfSGa4q_ktrzcPiYv1dM8GrAZj

 

Thanks

 

Hi @sajal161292,

 

PLease try the steps below.

1. Add a new table.

Table = VALUES(Shortages[Due Date])

2. Create a new measure.

Measure =
VAR lastday =
    CALCULATE (
        MAX ( 'Shortages'[Due Date] ),
        FILTER (
            ALL ( 'Table'[Due Date] ),
            'Table'[Due Date] < MAX ( 'Table'[Due Date] )
        )
    )
RETURN
    IF (
        ISBLANK ( MIN ( 'Shortages'[Due Date] ) ),
        CALCULATE (
            SUM ( Shortages[quantity] ),
            FILTER ( ALL ( 'Table'[Due Date] ), 'Table'[Due Date] = lastday )
        ),
        SUM ( Shortages[quantity] )
    )

need_to_extend_the_quantities_across_all_dates

 

Please be aware of your privacy.

 

Best Regards,

Dale

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

Hi,

 

I followed these steps but it is giving incorrect results to me.

 

short_xls6.png

So could you please check it from your end ?

 

 

It worked now.Thanks for your help!!

 

 

But actually the requirement has changed now.

 

short_xls7.png

Now the purpose is to retain the total field at the bottom with the previous values in case of missing quantitites for any date.

This total is basically thr running total field(which adds up the quantities across all the order types).

 

Please find the link of my visual attached below:

 

https://drive.google.com/open?id=1cCnbdHqfSGa4q_ktrzcPiYv1dM8GrAZj

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors