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
Brewster0101
New Member

Inventory Month on Month comparison

Hello, 

I'm trying to create in Power BI a month on month comparison of stock value by SKU/ID

Struggling to find a solution. 

 

My data looks like this, 

Month (Date)SKU/IDValue 
June23 10.26
July23 10.36
Aug23 10.10
June23 20.50
July23 20.75
June23 31.20
Aug2330.50

 

The output I'm trying to get to is a table of the month to month change so I can by month see the biggest varience by value and percentage change.

 

Many thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Brewster0101 ,

 

I think you can try code as below to create measures.

Previous Data by SKU = 
VAR _PREVIOUSVALUE =
    CALCULATE (
        MAX ( 'Table'[Month (Date)] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[SKU/ID] ),
            'Table'[Month (Date)] < MAX ( 'Table'[Month (Date)] )
        )
    )
RETURN
    CALCULATE (
        SUM ( 'Table'[Value ] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[SKU/ID] ),
            'Table'[Month (Date)] = _PREVIOUSVALUE
        )
    )
Diff = CALCULATE(SUM('Table'[Value ])) - [Previous Data by SKU]
Change Percentage = 
DIVIDE([Diff],[Previous Data by SKU])

Result is as below.

vrzhoumsft_0-1699346454237.png

 

Best Regards,
Rico Zhou

 

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

View solution in original post

4 REPLIES 4
Brewster0101
New Member

Many thanks - that worked perfectly 🙂 

rajulshah
Resident Rockstar
Resident Rockstar

@Brewster0101 

 

I think this is what you are looking for - link

 

Please let me know if this is not what you want.

Many thanks for reply. 

I've tried a few of these examples, but they all have only two sets of data to consider,  Date and sales 

I need to also consider a third data set - SKU/PN 

Anonymous
Not applicable

Hi @Brewster0101 ,

 

I think you can try code as below to create measures.

Previous Data by SKU = 
VAR _PREVIOUSVALUE =
    CALCULATE (
        MAX ( 'Table'[Month (Date)] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[SKU/ID] ),
            'Table'[Month (Date)] < MAX ( 'Table'[Month (Date)] )
        )
    )
RETURN
    CALCULATE (
        SUM ( 'Table'[Value ] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[SKU/ID] ),
            'Table'[Month (Date)] = _PREVIOUSVALUE
        )
    )
Diff = CALCULATE(SUM('Table'[Value ])) - [Previous Data by SKU]
Change Percentage = 
DIVIDE([Diff],[Previous Data by SKU])

Result is as below.

vrzhoumsft_0-1699346454237.png

 

Best Regards,
Rico Zhou

 

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

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