Forum Discussion
Anonymous
6 years agoNot applicable
Subtract total from previous values
Hi, I've a table with packageid and expiry date. How to get a total of values where we can substract with the previous value? I need the values in new balance where it filter the max [update] then ta...
- Anonymous6 years ago
HI Anonymous ,
You can try this Calculated Column
New Bal = VAR b = CALCULATE ( MAX ( 'Table'[update] ), FILTER ( 'Table', 'Table'[packageid] = EARLIER ( 'Table'[packageid] ) ) ) VAR c = 'Table'[balance] - 'Table'[qty] VAR d = CALCULATE ( c, 'Table'[update] = b ) VAR e = SUMX ( FILTER ( 'Table', 'Table'[packageid] = EARLIER ( 'Table'[packageid] ) && 'Table'[update] > EARLIER ( 'Table'[update] ) ), 'Table'[qty] ) RETURN IF ( 'Table'[update] = b, d, c - e )
Regards,Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)Did I answer your question? Mark my post as a solution!
Anonymous
6 years agoNot applicable
HI Anonymous ,
You can try this Calculated Column
New Bal =
VAR b =
CALCULATE (
MAX ( 'Table'[update] ),
FILTER (
'Table',
'Table'[packageid]
= EARLIER ( 'Table'[packageid] )
)
)
VAR c = 'Table'[balance] - 'Table'[qty]
VAR d =
CALCULATE (
c,
'Table'[update] = b
)
VAR e =
SUMX (
FILTER (
'Table',
'Table'[packageid]
= EARLIER ( 'Table'[packageid] )
&& 'Table'[update]
> EARLIER ( 'Table'[update] )
),
'Table'[qty]
)
RETURN
IF (
'Table'[update] = b,
d,
c - e
)
Regards,
Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
- Anonymous6 years agoNot applicable
Thank you so much! Anonymous It worked just how I want. Thanks!