Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

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

 

 

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:

 

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

 

Cheers Guys!!

 

9 Replies

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

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

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Mahesh

       

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

       

       

      Can you explain a bit more please?

       

       

       

      • Mahesh0016's avatar
        Mahesh0016
        Icon for Super User rankSuper User

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Can anyone help me please? 🙂