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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
nicolasvc
Helper III
Helper III

Reset value from EARLIER function

 

I have a table like the following one, in which I calculate the cumulative sum of the price column using the EARLIEST function, something like this: sum = calculate (sum ('A' [price])) , FILTER ('A', [index] <= EARLIER ('A' [index])))

 

 

indexStoreYearMonthproductprice
1120211A8000
2120212B1000
3120213C5000

 

indexStoreYearMonthproductpricesum
1120211A80008000
2120212B10009000
3120213C500014000

 

But now I will have more than one store and I need to reset the value of the sum every time the center is changed, is it possible to do it?

 

indexStoreYearMonthproductpricesum
1120211A80008000
2120212B10009000
3120213C500014000
4220211A10001000
5220212B30004000
6220213C50009000

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@nicolasvc ,

Try like

calculate (sum ('A' [price])) , FILTER ('A', [index] <= EARLIER ('A' [index]) &&  [store] = EARLIER ('A' [store]) ))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@nicolasvc ,

Try like

calculate (sum ('A' [price])) , FILTER ('A', [index] <= EARLIER ('A' [index]) &&  [store] = EARLIER ('A' [store]) ))

Thanks, that helped me.!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.