Forum Discussion

yannaingoo's avatar
yannaingoo
Icon for Advocate II rankAdvocate II
1 day ago

Calculated function in Direct Query

I try to achieved this calculated column and work fine in Import Mode but In Direct Query it does not work for CALCULATE and REMOVEFILTERS. how could i possible to achieved it?

Test =

VAR CurrentDate = Workstation_HealthCheck[checked_at]

VAR CurrentIndex = Workstation_HealthCheck[id]

VAR PreviousDate =

CALCULATE (

MAX ( Workstation_HealthCheck[checked_at] ),

Workstation_HealthCheck[id] = CurrentIndex - 2,

REMOVEFILTERS ( Workstation_HealthCheck )

)

VAR TimeDifference =

DATEDIFF ( PreviousDate, CurrentDate, HOUR )

 

RETURN

IF (

ISBLANK ( PreviousDate ),

"UP", -- Or "First Check-in"

IF ( TimeDifference > 4, "DOWN", "UP" )

)