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
Anonymous
Not applicable

show previous week value

Hello Guys
I have created 2 measure opening value and closeing value week wise i want to slow opening value of new week should be closing value of previous week using dax 
please help
please refer below data set

WeekNOOpening inventorycloseing Inventory
week125
week257
week376
week464
week549

Closing inventory of week 1 is 5 then for week 2 opening inventory should be 5
please help
Thanks

2 REPLIES 2
TomasAndersson
Solution Sage
Solution Sage

Hi!

Does you column [WeekNO] have entries as in your example, week1, week2 etc?

This should work then. It depends on finding the WeekNO closest before to the current week and then determining "Closeing Inventory" for that week (to use as Opening for this week). 

Opening Inventory = 
VAR ThisWeek = Table[WeekNO]
VAR PreviousWeek = 
CALCULATE(
    max('Table'[WeekNO]),
    FILTER(ALL('Table'), 'Table'[WeekNO] < ThisWeek
    )
)
return
CALCULATE(
    sum('Table'[Closeing Inventory]),
    FILTER(ALL('Table'), 'Table'[WeekNO] = PreviousWeek
    )
)

 

Anonymous
Not applicable

Hi @Anonymous , refer below

 

Work on Week Vs Week using Rank

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

 

Example

Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)	
This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52))) 

 

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