Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi All,
I have a table which have Date tiem columns and a data columns. Consider column name 'high'
I want to compare recirds with the previous value on same column on the basis on datetime column.
The above is the sample ss of the data. How can i achive this?
Solved! Go to Solution.
Hi @sarvesh23p ,
Please try this code to create a measure.
Open Diff =
VAR _Previous_Datetime =
CALCULATE (
MAX ( 'Table'[Datetime] ),
FILTER ( ALL ( 'Table' ), 'Table'[Datetime] < MAX ( 'Table'[Datetime] ) )
)
VAR _Previous_value =
CALCULATE (
SUM ( 'Table'[Open] ),
FILTER ( ALL ( 'Table' ), 'Table'[Datetime] = _Previous_Datetime )
)
VAR _Current_value =
CALCULATE ( SUM ( 'Table'[Open] ) )
RETURN
_Current_value - _Previous_value
My Sample:
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @sarvesh23p ,
Please try this code to create a measure.
Open Diff =
VAR _Previous_Datetime =
CALCULATE (
MAX ( 'Table'[Datetime] ),
FILTER ( ALL ( 'Table' ), 'Table'[Datetime] < MAX ( 'Table'[Datetime] ) )
)
VAR _Previous_value =
CALCULATE (
SUM ( 'Table'[Open] ),
FILTER ( ALL ( 'Table' ), 'Table'[Datetime] = _Previous_Datetime )
)
VAR _Current_value =
CALCULATE ( SUM ( 'Table'[Open] ) )
RETURN
_Current_value - _Previous_value
My Sample:
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!