Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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/ID | Value |
June23 | 1 | 0.26 |
July23 | 1 | 0.36 |
Aug23 | 1 | 0.10 |
June23 | 2 | 0.50 |
July23 | 2 | 0.75 |
June23 | 3 | 1.20 |
Aug23 | 3 | 0.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
Solved! Go to Solution.
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.
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.
Many thanks - that worked perfectly 🙂
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
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.
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.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.