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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
mhsk
Helper II
Helper II

Running Total Week Calculation

Hi Community,

 

I hope this will be simple question, im trying to achieve what is calculation in column marked yellow:

 

 

Przechwytywanie.PNG

 

 

 

 

 

 

 

So i have a table by Item number and by week both with supply and demand and i would like to write a measure showing me what is the stock level for each week (starting week should take Start Stock Value) and leter stock level should be calculated from previous week. is ist doable?

7 REPLIES 7
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @mhsk ,

 

Below is the solution of a calculated column based on your data here. Maybe you have other conditions. Please reply to this. 

Column =
VAR currentWeek = [Week of Year]
RETURN
    [Start Stock]
        + CALCULATE (
            SUM ( Table1[SUPPLY] ) - SUM ( Table1[DEMAND] ),
            FILTER ( 'Table1', 'Table1'[Week of Year] <= currentWeek )
        )

Running-Total-Week-Calculation

 

 

Best Regards,

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.

OK, this will work pretty good while you have 1 item and week numbers dosnt duplicate. but what if table has many items and then many the same week's in column week of year. how can i tell power bi that im looking for this specific item context?

 

(if i apply this calculated column to data where more than one occurence of the same week exist then it crashes )

smpa01
Community Champion
Community Champion

@mhsk Can you please provide a sample data ?


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================

Hi,

 

pbix file with expected outcome attached, it is a bit different than previously, i can merge demand and supply table on part and weekyear if needed.

 

https://www.sendspace.com/file/8nowwu

any ideas?

This is how it looks: So i would also need dax to know that we are looking at this item only and this week 

Przechwytywanie.PNG

Hi @mhsk ,

 

Can you share a new sample that can be more accurate to display your model? Please share the pbix file if you can. Please mask the sensitive parts first.

 

 

Best Regards,

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.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.