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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I would like to create a new column that would subtract the row values in 'FH' based on the 'Product'. The sample data set and corresponding expected output is as shown below. Kindly help.
Thanks.
| Product | FH | Expected Outcome |
| A | 2000 | 0 |
| A | 5000 | 3000 |
| A | 9000 | 4000 |
| B | 2500 | 0 |
| B | 6000 | 3500 |
| B | 10000 | 4000 |
Try this
Output =
var _CurrentProduct=NewTable[Product]
var _PreviousFH= MAXX(FILTER(NewTable,NewTable[FH]<EARLIER(NewTable[FH]) && NewTable[Product]=_CurrentProduct),NewTable[FH])
var _result=NewTable[FH]-_PreviousFH
return IF(ISBLANK(_PreviousFH),0,_result)
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
@Zabeer , Try like a new column
Expected = [FH] - maxx(filter(table,[Product] = earlier([Product]) && [FH] < earlier([FH])),[FH])
Ideally, there should date to do this
Hi @Zabeer
try a column
Expected Outcome =
var _prevVal = CALCULATE(MAX('Table'[FH]),FILTER('Table','Table'[Product]=EARLIER('Table'[Product]) && 'Table'[FH] < EARLIER('Table'[FH])))
RETURN
IF(ISBLANK(_prevVal), 0, _prevVal)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 99 | |
| 76 | |
| 56 | |
| 51 | |
| 46 |