Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Show last 12 months data

Hi , I need to display Last 12  months data for a measure deoending on Year and Month selection. I managed to write the measure, but when put in the Line chart, it gets filtered only for the select...
  • v-deddai1-msft's avatar
    5 years ago

    Hi Anonymous ,

     

    Did you have a dim_ date table? I suggest you create a date table and then you can use the following measure:

     

    Last 12 months Sales =
    VAR Start_date =
        CALCULATE ( MAX ( Dim_Date[Date] ), ALLSELECTED ( Dim_Date ) )
    RETURN
        CALCULATE (
            [Measure],
            ALL ( Dim_Date ),
            DATESINPERIOD ( Dim_Date[Date], [Start_date], -12, MONTH )
        )

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai