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
PSB
Helper III
Helper III

Power Query to calculate values based on previous 7 days values

I need Power Query to generate value in formula coulumn by below formula.

Each of the value is created with sum of previous 7 days values. Sample in table below.

 

Forumula column in Date 11/21 should caluculate below value based on data from 11/15 to 11/21

Formula = SUM(D2:D7)/SUM(E2:E7)

 

PERIOD_START_TIMEABFormula
11/15/202353437886716507726 
11/16/202353514227817353159 
11/17/202355079255516567704 
11/18/202351839833715864102 
11/19/202347200093515344195 
11/20/202352567095016507234 
11/21/20235543132631616205831.96
11/22/20235619122331659368532.27
11/23/20234972686781531963532.80
11/24/20235236027571623859332.67
11/25/20235023689841612741832.60
11/26/20234770621091551396132.65
11/27/20234768906681599418232.48
11/28/20234841043621574769331.73
11/29/20234956615751533754631.19

 

 

2 ACCEPTED SOLUTIONS
Ahmedx
Super User
Super User

My ultimate goal is to achieve this formula. Do you suggest to add half of calculations to M1 and M2 or it can be added to Measure?

=100*((SUM(E10:E16)+SUM(F10:F16)-SUM(G10:G16)-SUM(H10:H16))/(SUM(D10:D16)+SUM(E10:E16)+SUM(F10:F16)-SUM(G10:G16)-SUM(H10:H16)))

View solution in original post

5 REPLIES 5
PSB
Helper III
Helper III

My ultimate goal is to achieve this formula. Do you suggest to add half of calculations to M1 and M2 or it can be added to Measure?

=100*((SUM(E10:E16)+SUM(F10:F16)-SUM(G10:G16)-SUM(H10:H16))/(SUM(D10:D16)+SUM(E10:E16)+SUM(F10:F16)-SUM(G10:G16)-SUM(H10:H16)))

Ahmedx
Super User
Super User

pls try this

Screenshot_1.png

My ultimate goal is to achieve this formula. Do you suggest to add half of calculations to M1 and M2 or it can be added to Measure?

=100*((SUM(E10:E16)+SUM(F10:F16)-SUM(G10:G16)-SUM(H10:H16))/(SUM(D10:D16)+SUM(E10:E16)+SUM(F10:F16)-SUM(G10:G16)-SUM(H10:H16)))

where was it written that you want this is the formula, you didn’t write at the beginning

and this formula is incomprehensible, how do I know what it is

E10:E16

G10:G16

.....

PSB
Helper III
Helper III

@amitchandak can you please help? even DAX Query will do.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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