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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

cumulative stock with dax

HI,

 

How i can have cumulative planned stock calculated with dax on weekly level.

17.4.2018 9.33.png

so below initial stock would be planned stock based on initial stock+planned production - total demand plan

 

br. J

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi

From your matrix, I guess your dataset is like this, right?

61.png

If it is in this case, first create a calculated column in original table to get the planned stock value

 

planned stock =
CALCULATE (
    MAX ( [value] ),
    FILTER (
        ALLEXCEPT ( Table1, Table1[weekly level] ),
        [category] = "Initial stock"
    )
)
    + CALCULATE (
        MAX ( [value] ),
        FILTER (
            ALLEXCEPT ( Table1, Table1[weekly level] ),
            [category] = "Planned production"
        )
    )
    - CALCULATE (
        MAX ( [value] ),
        FILTER (
            ALLEXCEPT ( Table1, Table1[weekly level] ),
            [category] = "Total demand plan"
        )
    )

Second

Create a new table

 

Table 2 =
UNION (
    SUMMARIZE ( Table1, Table1[weekly level], Table1[category], Table1[value] ),
    SUMMARIZE (
        Table1,
        Table1[weekly level],
        "category", "Planned stock",
        "value", SELECTEDVALUE ( Table1[planned stock] )
    )
)

Finally the matrix shows the “Planned stock” on the row and its value.

62.png

In addition, it is noted that when we use calculated column in matrix to show value of 'Planned stock', its value can't change by any slicer or filter.

 

Best Regards

Maggie

 

 

Best Regards

Maggie

Anonymous
Not applicable

Thanks Maggie!

 

Issue is that I have 3 dataset's which are gathered to this matrix. Would that calculation be working still?

And what happens to planned stock when initial stock is still "0" in future? Cause it should always use current week initial for planned stock

 

BR. J

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors