Forum Discussion
Analitika
Post Prodigy
4 years agoDifference calculation in same table but per different row and tables in Power BI
Hello,
I am trying to implement difference calculation. Here is my data table:
My expected result is here:
But I am getting this output which is wrong:
0.87!=3289.13
Below is DAX query:
Column =
VAR _0 = MAXX(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'[deb] <> 0,_1 - 'x'[deb], blank(
- Anonymous4 years ago
Hi Analitika ,
Please try:
Column = VAR _0 = MAXX(FILTER('x', '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,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
Hi Analitika ,
Please try:
Column = VAR _0 = MAXX(FILTER('x', '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,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.