Forum Discussion

rogerthat's avatar
rogerthat
Helper I
3 years ago
Solved

EARLIER Function too Slow!

Hi,

 

I currently have the below calculated column and I suspect the EARLIER function is taking most of the memory when I try to refresh.

ObjectIndex =
CALCULATE (
    COUNT ( DATA[ID ),
    ALLEXCEPT ( DATA, DATA[ID )),
    DATA[Date )<= EARLIER ( DATA[Date] ) )
)
 
StatusStreak is dependent on the above.
 
DATA REFERENCE:
IDStatusDateStatusStreakObjectIndex
XYXCOMPLETED4/15/202311
XYXCOMPLETED4/16/202322
XYXFAILED4/17/202313
XYXCOMPLETED4/18/202314
XYXCOMPLETED4/19/202325
XYXCOMPLETED4/20/202336
XYXCOMPLETED4/21/202347
XYXCOMPLETED4/22/202358
XYXFAILED4/23/202319
XYXCOMPLETED4/27/2023110
XYXCOMPLETED4/28/2023211
XYXCOMPLETED4/29/2023312
XYXCOMPLETED4/30/2023413
XYXCOMPLETED5/1/2023514
XYXCOMPLETED5/2/2023615
XYXCOMPLETED5/3/2023716
XYXCOMPLETED5/4/2023817
XYXCOMPLETED5/5/2023918
XYXCOMPLETED5/6/20231019
XYXCOMPLETED5/7/20231120
XYXCOMPLETED5/8/20231221
XYXCOMPLETED5/9/20231322
XYXCOMPLETED5/10/20231423
XYXCOMPLETED5/11/20231524
XYXCOMPLETED5/12/20231625
XYXCOMPLETED5/13/20231726
XYXCOMPLETED5/14/20231827
XYXCOMPLETED5/15/20231928
XYXCOMPLETED5/16/20232029
XYXCOMPLETED5/17/20232130
XYXCOMPLETED5/18/20232231
XYXCOMPLETED5/19/20232332
XYXCOMPLETED5/20/20232433
XYXCOMPLETED5/21/20232534
XYXCOMPLETED5/22/20232635
XYXCOMPLETED5/23/20232736
XYXCOMPLETED5/24/20232837
XYXCOMPLETED5/25/20232938
XYXCOMPLETED5/26/20233039
XYXCOMPLETED5/30/20233140
XYXCOMPLETED5/31/20233241
XYXCOMPLETED6/1/20233342
XYXCOMPLETED6/2/20233443
XYXCOMPLETED6/4/20233544
XYXCOMPLETED6/5/20233645
XYXCOMPLETED6/6/20233746
XYXCOMPLETED6/7/20233847
XYXCOMPLETED6/8/20233948
XYXCOMPLETED6/9/20234049
XYXCOMPLETED6/13/20234150
XYXCOMPLETED6/14/20234251
XYXCOMPLETED6/15/20234352
XYXCOMPLETED6/16/20234453
XYXCOMPLETED6/17/20234554
XYXCOMPLETED6/18/20234655
XYXCOMPLETED6/19/20234756
XYXCOMPLETED6/20/20234857
XYXCOMPLETED6/21/20234958
XYXCOMPLETED6/22/20235059
XYXCOMPLETED6/23/20235160
XYXCOMPLETED6/24/20235261
XYXCOMPLETED6/25/20235362
XYXCOMPLETED6/26/20235463
XYXCOMPLETED6/27/20235564
XYXCOMPLETED6/28/20235665
XYXCOMPLETED6/29/20235766
XYXCOMPLETED6/30/20235867
XYXCOMPLETED7/1/20235968
XYXCOMPLETED7/2/20236069
XYXCOMPLETED7/3/20236170
XYXCOMPLETED7/4/20236271
 

Is there an alternative to what I'm trying to do without having to impact performance?

  • rogerthat You could try this:

    ObjectIndex =
    VAR __Date = MAX(DATA[Date])
    VAR __Return = 
    CALCULATE (
        COUNT ( DATA[ID ),
        ALLEXCEPT ( DATA, DATA[ID )),
        DATA[Date )<= __Date ) )
    )
    RETURN
      __Return

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    rogerthat You could try this:

    ObjectIndex =
    VAR __Date = MAX(DATA[Date])
    VAR __Return = 
    CALCULATE (
        COUNT ( DATA[ID ),
        ALLEXCEPT ( DATA, DATA[ID )),
        DATA[Date )<= __Date ) )
    )
    RETURN
      __Return