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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PowerBIprentice
Regular Visitor

Trailing twelve month variable on computed field doesn't update with time slicer

Dear Community, I am confronted with the following situation:

Context:

I want to create a graph that shows the evolution of my sales over the last 12 months (Trailing Twelve months - TTM) BUT where each month is already the sum of the last 12 months (Moving Annul Total - MAT). And I'd like this view to change according to a time slicer. For example, if I choose the month of May 23, I should see:

  • The month of May 23', the sum of the months from May 22 to May 23.
  • The month of April 23', the sum of april 22 to april 23.
  • The month of March 23', the sum of march 22 to march 23.
  • Etc... for a total of 12 months

 

Problem:

My problem is that the graph doesn't follow the time slicer at all. When I put a month in my slicer, the graph gives me a single value for the last 30 days, whereas I'd like to see the last 12 months.

 

TTM sales power BI.PNG

 

 

This is what I've done:

  • I created a value for the MAT of sales

Sales_MAT = CALCULATE(    

                            sum(Sales[Sales]),DATESINPERIOD('Date Dimension'[DateDimension],

MAX('Date Dimension'[DateDimension]),-12,MONTH) )

 

  • I created a value allowing me to have the last 12 months

TTM_Total_Sales =

VAR CurrentDate = MAX('Date Dimension'[DateDimension])

VAR PreviousDate = DATE(YEAR(CurrentDate),MONTH(CurrentDate)-12,DAY(CurrentDate))

VAR Result =

CALCULATE(

        Sales[Sales_MAT],

        FILTER(

            ALL('Date Dimension'[DateDimension]),

           'Date Dimension'[DateDimension]>=PreviousDate && 'Date Dimension'[DateDimension]<=CurrentDate

        )

)

RETURN

Result

 

And I don't understand what else I need to do....

 

Already thank you for your help !

 

For those who prefer to work with the full file, you can download it here (through "We transfer"): https://we.tl/t-xDys0zqAHG

0 REPLIES 0

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors