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

Cummulative Average

 

I have a cost table per week of year (page filtered by this year).   I want to set the cummulative average per week.

gerardotrejogcg_0-1617942764961.png

LT 2 - 95.4

LT 3 -  89 ( [95.4+82.6] / 2)

LT 4 -  88.8 ( [95.4+82.6+88.4] / 3)

 

wanted to use an average but no way how to start with this.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@gerardotrejogcg , Try a new column like

 

averageX(filter(allselected(Table), Table[segement]= max(Table[Segment]) && Table[Week] <= max(Table[Week])),Table[Value])

 

in place of this column Table[Value], you can use a measure too

 

I have assume week on column of matrix

View solution in original post

2 REPLIES 2

@amitchandak Thanks for your reply.   Actually I have another complexity.    My Date table is populated from Actuals Date (Start) and Forecast Date (End) ...  Eg.  Jan 1st, 2015 - Dec 31st, 2021.

 

Since my measure is using Actuals the last date is April 2021 so no issues.  

SCM Price P/U = DIVIDE ( [SCM Sales] , [SCM Units])

gerardotrejogcg_0-1618245908207.png

  But I want to use your code it's populating the 53 weeks of year.   How can I filter by the last "Actual" week of year ?

 

SCM Price P/U Avg =
AVERAGEX (  FILTER (  ALLSELECTED ( 'Date' ),  'Date'[Week of Year] <= MAX ( 'Date'[Week of Year] )  ),
[SCM Price P/U] )
 
amitchandak
Super User
Super User

@gerardotrejogcg , Try a new column like

 

averageX(filter(allselected(Table), Table[segement]= max(Table[Segment]) && Table[Week] <= max(Table[Week])),Table[Value])

 

in place of this column Table[Value], you can use a measure too

 

I have assume week on column of matrix

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