Forum Discussion
Zabeer
6 years agoHelper I
Subtracting rows based on another column category
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....
nandukrishnavs
6 years agoCommunity Champion
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 🙂