Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Reigning_data
Frequent Visitor

Comparing Current and Previous Moving Annual Total (MAT)

Hello All,

 

Context: I am trying to compare the Current MAT with Previous MAT by month. The idea being that I would have a bar, or line, graph, showing 'current MAT' as of Aug 2018 compared to 'Previous MAT' as of Aug 2017.

 

So Far: I've been fiddling with a couple of different MAT formulae.

 

MAT Current Year = 
CALCULATE (
    [Total Value],
    FILTER (
        ALL ( 'Calendar'),
        'Calendar'[Sequential Day Number] > MAX ( 'Calendar'[Sequential Day Number] ) - 365
             && 'Calendar'[Sequential Day Number] <= MAX ( 'Calendar'[Sequential Day Number] )
    )
)

And.

MAT Current Year V2 = 
CALCULATE (
    SUMX(
        FILTER( 'table1','table1'[sales]),
        [Total Value]
    ),
    DATESINPERIOD(
        'Calendar'[Date],LASTDATE ( 'Calendar'[Date]),
        -12,
        MONTH
    )
)

These are doing exactly what they are supposed to - calculate the MAT each month.

 

Problem: So, how do I go about displaying a 'previous MAT' side-by-side with the current? At first I tried the date criteria to be 'a year earlier' like so:

 

MAT Previous Year = 
 
CALCULATE (
    [Total Value],
    FILTER (
        ALL ( 'Calendar'),
        'Calendar'[Sequential Day Number] > MAX( 'Calendar'[Sequential Day Number] ) - 730
             && 'Calendar'[Sequential Day Number] <= MAX ( 'Calendar'[Sequential Day Number] ) - 365 )
)

But it does not come out with the desired results:

 

By YearBy YearBy MonthBy Month

 

Is this an issue with formula or an issue with how I am displaying it?

 

Many thanks in advance!

1 REPLY 1
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Reigning_data,

 

You should add [dates] from calendar table into chart X-axis. Besides, please use SAMEPERIODLASTYEAR to calculate MAT in previous year.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.