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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Ortignano
Helper I
Helper I

Rollinh 12 month of comulative shipments

Hello,

 

I have shipments table with a cumulative shipments defined as:

=CALCULATE(SUM(Shipments[ShipQty]);FILTER(ALL(DateCalendarMonthID);DateCalendarMonthID[MonthID]<=MAX(DateCalendarMonthID[MonthID])))

 

Now I would calculate the average of the last 12 cumulative month

 

I try with 

=CALCULATE([cumulative shipments]);FILTER (
ALL ( DateCalendarMonthID );
DateCalendarMonthID[MonthID] <= MAX ( DateCalendarMonthID[MonthID] )
&& DateCalendarMonthID[MonthID]
>= MAX ( DateCalendarMonthID[MonthID] ) - 11
)
)/12

 

but it returns again the last cumulative value divided by 12 and not the sum of last 12 months divided by 12

 

Any suggestion?

Thanks

Antonio

3 REPLIES 3
amitchandak
Super User
Super User

@Ortignano , Try a formula like the given example with date table

 

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))/12

Sorry I was not so clear, your formula calculates the sum of last 12 month sales, instead, I would calculate the sum of last 12-month cumulative.

like

 

table.png

What I have found till now is to use:

 

RunningArea =
VAR MyTable = SUMMARIZE(FILTER(ALL(DateCalendarMonthID);DateCalendarMonthID[Date]<=MAX(DateCalendarMonthID[Date])&& DateCalendarMonthID[Date]>=MAX(DateCalendarMonthID[Date])-11);DateCalendarMonthID[Date];"Comulative_shipments";[Comulative_shipments])
RETURN SUMX(MyTable;[Comulative_shipments])

 

But it give me the overall sum of the comulative_shipments and I'm not able to make the formula works only for last 12 months

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors