Forum Discussion

achanikya's avatar
achanikya
Icon for Helper I rankHelper I
4 years ago
Solved

Rolling 12 YY-Month

Hi Team,  i want to display sales amount for last 12 Completed month in Line Chart.   For Example: If january 2022 once Came, that time line chart should show the data From Feb-2021 To Jan -2022....
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi achanikya ,

     

    If the last 12 months are always based on current date, you could simply use Relative Date filter as shown below:

     

    2/11/2021-1/10/2022

     

    Or if you want to dynamically change it based on date selection in slicer, please firstly create a date table for slicer, and then create a measure for filter:

    ForSlicer = VALUES('Table'[Date])
    Measure = 
    var _date= DATE(MAX('ForSlicer'[Date].[Year]), MAX('ForSlicer'[Date].[MonthNo]),1)
    var _diff= DATEDIFF(MAX('Table'[Date]),_date,MONTH)
    return IF(_diff>=0&& _diff<12,1,0)

    2021/2/1-2022/1/10

     

     

     

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