Forum Discussion

mayankkverma95's avatar
mayankkverma95
Regular Visitor
5 years ago
Solved

MAT Calculation in Power BI

Hi Everyone, I got stuck while calculating MAT (Moving Annual Total) in my report. Data Scenario- I have data which is only for latest period. Below is a raw snap: ProductID Date Current Valu...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi mayankkverma95 ,

    I created a sample pbix file(see attachment), please check whether that is what you want.

    1. Make a data conversion so that the values of different years are displayed in the same column and the corresponding dates are added respectively as shown in below screenshot

    2. Create a measure as below to get MAT just as suggested by amitchandak 

     

    MTD = 
    CALCULATE (
        SUM ( 'Table'[Values] ),
        DATESYTD ( DATEADD ( 'Date'[Date], -1, YEAR ), "12/31" )
    )

     

    In addition, please review the content in the following video. Help it can help you~

    Power BI M Code for Moving Annual Total (MAT)

    Best Regards