Forum Discussion
Analitika
Post Prodigy
5 years agoCalculating difference per rows in different columns in Power BI
Hello, I have issue calculating the difference between different column values in same table. The result in a new created column is wrong. My data input table is here: My output result is...
Anonymous
5 years agoNot applicable
HI Analitika,
You can try to use the following calculated column formulas if it helps:
column =
VAR NextDate =
CALCULATE (
MIN ( Table[Date] ),
FILTER (
Table,
[ID] = EARLIER ( Table[ID] )
&& [OBJ_ID] = EARLIER ( Table[OBJ_ID] )
&& [Date] > EARLIER ( Table[Date] )
)
)
VAR CRE =
CALCULATE (
MAX ( Table[CRE] ),
FILTER (
Table,
[ID] = EARLIER ( Table[ID] )
&& [OBJ_ID] = EARLIER ( Table[OBJ_ID] )
&& [Date] = NextDate
)
)
RETURN
IF ( [DEF] <> 0, CRE - [DET] )
Regards,
Xiaoxin Sheng