Forum Discussion
Mann
Resolver III
6 years agoPerformance Issue with EARLIER
Hi Guys, In my dataset I am getting Individual IDs, Start Time, End Time and Index. We are recording entry and exit times of Individuals using multiple source so these Start and End Time can be...
v-lili6-msft
Community Support
6 years agohi Mann
You need to use Variables in the formula instead of EARLIER
Column 5 =
VAR _Index = Table1[Index]
VAR _IndID = Table1[Ind ID]
VAR _MaxEndTime =
CALCULATE (
MAX ( Table1[End Time] ),
FILTER ( Table1, Table1[Ind ID] = _IndID && Table1[Index] <= _Index )
)
RETURN
IF ( Table1[End Time] = BLANK (),1, IF ( Table1[End Time] < _MaxEndTime, 0, 1 ) )
or
Column 4 =
var _Index=Table1[Index] return
VAR _MaxEndTime=
CALCULATE (
MAX ( Table1[End Time] ),
FILTER (
ALLEXCEPT(Table1,Table1[Ind ID]),
Table1[Index] <= _Index
)
)
Return
IF(Table1[End Time]=BLANK(),1,IF(Table1[End Time]<_MaxEndTime,0,1))
https://exceleratorbi.com.au/using-variables-dax/
Regards,
Lin
Mann
Resolver III
6 years agoThanks v-lili6-msft
I used the code you provided. Still it is not working as expected. It is taking forever to return results with 1Mn rows and RAM is going over 25GB.
Can we re-write this logic some other way. If we need to create more calculated column, thats fine, provided we are getting performant results.
Thanks
- Mann6 years ago
Resolver III
Hi
Can somebody help or advice if this can be done.
Thanks