Forum Discussion

oilman's avatar
oilman
Regular Visitor
7 years ago
Solved

12 months rolling averge

Hello, i have calculation for Mean Distance between failure (MDBF) but need help to make a 12 months rolling average for MDBF. I understand i need a DAX formula in connection with my formula below.

 

NOF= Number of failures

 

My calculation for MDBF is: 

 

MDBF = if(sum([NOF])>0;sum(Distance])/sum([NOF]);sum([Distance]))
  • oilman

     

    You can use the following formula:

    Sales12M := CALCULATE (
        SUM([Distance]),
        DATESBETWEEN (
            Calendar[FullDate],
            NEXTDAY ( SAMEPERIODLASTYEAR ( LASTDATE ( Calendar[FullDate] ) ) ),
            LASTDATE ( Calendar[FullDate] )
        )
    )

    Best to add a customer calendar and then use the formula.

    This sums the distance for the last 12 months. You can use the same formula for NOF and then divide the 2 measures.

     

    Second option is described hon this link.

     

     

2 Replies

  • themistoklis's avatar
    themistoklis
    Icon for Community Champion rankCommunity Champion

    oilman

     

    You can use the following formula:

    Sales12M := CALCULATE (
        SUM([Distance]),
        DATESBETWEEN (
            Calendar[FullDate],
            NEXTDAY ( SAMEPERIODLASTYEAR ( LASTDATE ( Calendar[FullDate] ) ) ),
            LASTDATE ( Calendar[FullDate] )
        )
    )

    Best to add a customer calendar and then use the formula.

    This sums the distance for the last 12 months. You can use the same formula for NOF and then divide the 2 measures.

     

    Second option is described hon this link.

     

     

    • oilman's avatar
      oilman
      Regular Visitor

      Thanks, that solved my problem