Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Kote101
Helper II
Helper II

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 1
v-frfei-msft
Community Support
Community Support

Hi @Kote101 ,

 

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.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.