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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rhawlor
Helper II
Helper II

Annualised 12 Month Sum Rolling

Hi PowerBi'ers!!

 

Nearly Chrismas 🙂

 

I have one for you all, which im sure is simple, but I've been trying different solutions ive seen on here and youtube, but it doesnt calculate right. 

 

Scenario:  x1 calculation column IW-MFR basically sums "IW-Faulty" and divides by "Cumulative Shipment" for each row

 

rhawlor_1-1671094116516.png

 

Aim: Create another column with a sum for rolling 12 months (sum the current row and the previous 11 rows) - This can be in Powrquery or a DAX column.

 

I have this in excel which is simple and is literally Sum previous current and previous 11 months:

rhawlor_2-1671094197780.png

 

This would make my Christmas if this could be solved!!! 🙂

 

Cheers Guys!!

 

9 REPLIES 9
rhawlor
Helper II
Helper II

Can anyone help me please? 🙂

Mahesh0016
Super User
Super User

SUM 12month =
VAR Total =
CALCULATE (
[Total ListPrice],
DATESINPERIOD ( 'Date'[Date], [LastCurrentDate], -12, MONTH )
)
RETURN
Total

******************************************************

LastCurrentDate = MAX('Date'[Date])
 
******************************************************
Total ListPrice = SUM(TrainingSample2[ListPrice])

 

Hi Mahesh

 

I have tried applying this in M Code in PQ and in Dax Table column, but i get varying errors:

 

rhawlor_0-1671102883728.png

 

Can you explain a bit more please?

 

 

 

Hi @rhawlor ,
You can not use in M Code it is use only Power bi desktop DAX Measure.

Thanks, ok that will be why it isnt working, I need a column added to the data, can you still help? 🙂

calculated column is useful for you instead of add column in data.

Yes i have tried that in New Column in DAX, but it just throws an error similar to the baove ones.

You can create a calculated column: 

 

Column = CALCULATE(SUM('Table3'[Value]),FILTER('Table3','Table3'[Date]<=EARLIER('Table3'[Date])))

Hi Mahesh

 

Thanks for the above, how do i incorporate the above to use only the previous 12 rows?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors