Forum Discussion

amirghaderi's avatar
amirghaderi
Helper IV
4 years ago
Solved

Weekly Movement calculation

Hi,

I have a table of data which capture "Cumulative Expended Manhours" on every week. I need a column/measure that calculates the weekly value for each activty code on that week. example table as below. I have attached the sample Power Bi data as well.

 

https://www.dropbox.com/s/5xwfcnq9is0ro6x/test.pbix?dl=0

 

 

Activity CodeWeek End DateCumulative Expended ManhoursPeriod Expended Manhours
test15-Oct-202115.0015.00
test22-Oct-202130.0015.00
test29-Oct-202145.0015.00
test05-Nov-202160.0015.00
test12-Nov-202175.0015.00
test19-Nov-202190.0015.00
test26-Nov-2021105.0015.00
test03-Dec-2021162.5057.50
test10-Dec-2021178.5016.00
test17-Dec-2021211.0032.50
test24-Dec-2021211.000
test31-Dec-2021211.000.00
test07-Jan-2022223.0012.00
test14-Jan-2022238.0015.00
test21-Jan-2022248.0010.00
test28-Jan-2022256.008.00
test04-Feb-2022267.0011.00
test219-Nov-20210.000
test226-Nov-20210.000
test203-Dec-20210.000
test210-Dec-20210.000
test217-Dec-20210.000
test224-Dec-20210.000
test231-Dec-20210.000
test207-Jan-202216.0016
test214-Jan-202232.0016
test221-Jan-202256.0024.00
test228-Jan-202256.000
test204-Feb-202277.0021.00

2 Replies

  • Hi,

    This calculated column formula works

    =Data[Cumulative Expended Manhours]-LOOKUPVALUE([Cumulative Expended Manhours],Data[Activity Code],Data[Activity Code],Data[Week End Date],CALCULATE(MAX(Data[Week End Date]),FILTER(Data,Data[Activity Code]=EARLIER(Data[Activity Code])&&Data[Week End Date]<EARLIER(Data[Week End Date]))))

    Hope this helps.