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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
amirghaderi
Helper IV
Helper IV

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
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1644375285452.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1644375285452.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Ashish_Mathur
Super User
Super User

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.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.