Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

3 Mth and 12 mth average the same

My first attempt at moving averages.  My problem is whether I have "-3", or "-12" its the same number.  All fields are coming from the same table. Also wondering if part of the problem is there are multiple "CostNet" entries for each "ReceivedDate".

 

An example of the RTP table:

Received Date    CostNet

1/1/2017             100

1/1/2017              50

1/3/2017              50

2/2/2017              75

2/2/2017              100

2/10/2017            50

....and so on

 

 

The measure:

 

MovingAverage3Months_CostNet =

CALCULATE (

    sumx(RTP,RTP[CostNet]),

    DATESINPERIOD (

        RTP[ReceivedDate],

        LASTDATE ( RTP[ReceivedDate] ),

        -12,

        MONTH

    )

)

 

 

 

  • Hi, 

     

    Do you have a separate date dimension table? That would be the first thing to do. Mark this as data table, and you can use time intelligence functions. Link your cist table to the date table. 

     

    More info, check this post.

     

     

3 Replies

  • waltheed's avatar
    waltheed
    Icon for Impactful Individual rankImpactful Individual

    Hi, 

     

    Do you have a separate date dimension table? That would be the first thing to do. Mark this as data table, and you can use time intelligence functions. Link your cist table to the date table. 

     

    More info, check this post.

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks!

      • waltheed's avatar
        waltheed
        Icon for Impactful Individual rankImpactful Individual

        You're welcome. Glad it worked for you.