Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

why doesnt the earlier function work when used within my calculation

Rolling Sum = 

var object_1 = Calculate(SUM('Table 1'[Value]),
   Filter(allselected('Table 1'),
      COUNTROWS(FILTER('Table 1',
         EARLIER('Table 1'[Date])<= 'Table 1'[Date]))))

var object_2 = Calculate(SUM('Table 2'[Value]),
   Filter(allselected('Table 2'),
      COUNTROWS(FILTER('Table 2',
         EARLIER('Table 2'[Date])<= 'Table 2'[Date]))))

return

calculate(object_1 - object_2,
   Filter(allselected('Date Table'),
      COUNTROWS(FILTER('Date 2',
         EARLIER('Date Table'[Date])<= 'Date Table'[Date]))))

I am trying to create a rolling sum from the results of a calculation between two values (object_1 and object_2). The problem is when i try to achieve this by using the calculate function + the earlier function, it doesn't seem to have any affect.

I have tried creating a virtual table with the values i am trying to create a rolling sum out of (using Summarize), then using earlier in a Sumx function to create the desired effect but this did not work.

1 Reply

  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi Anonymous ,

     

    Could you please share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.