Forum Discussion
Analitika
Post Prodigy
4 years agoSubstraction calculation between values in Power Bi
Hello, I would like to ask how calculate difference between values which are in different rows and columns. My query is: Column = VAR _0 = MINX(FILTER('x','x'[date]> EARLIER('x'[date]) && ...
- 4 years ago
Hi Analitika ,
Based on your formula and your expected output, you could change '>' to '=' in the formula like this:
Difference = VAR _0 = MINX ( FILTER ( 'x', 'x'[DATE] = EARLIER ( 'x'[DATE] ) && 'x'[ID] = EARLIER ( 'x'[ID] ) ), [DATE] ) VAR _1 = MAXX ( FILTER ( 'x', 'x'[DATE] = _0 && 'x'[ID] = EARLIER ( x[ID] ) ), [CRE] ) RETURN IF ( 'x'[DET] <> 0, _1 - 'x'[DET], BLANK () )Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yingjl
Community Support
4 years agoHi Analitika ,
Based on your formula and your expected output, you could change '>' to '=' in the formula like this:
Difference =
VAR _0 =
MINX (
FILTER (
'x',
'x'[DATE] = EARLIER ( 'x'[DATE] )
&& 'x'[ID] = EARLIER ( 'x'[ID] )
),
[DATE]
)
VAR _1 =
MAXX ( FILTER ( 'x', 'x'[DATE] = _0 && 'x'[ID] = EARLIER ( x[ID] ) ), [CRE] )
RETURN
IF ( 'x'[DET] <> 0, _1 - 'x'[DET], BLANK () )
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.