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
Anonymous
Not applicable

Moving Average for 4 level indexed values

Hi, 

 

I struggled with it a lot, searched all over the forums, but could not achieve reasonable results - moving average for selling price is needed based on previous 3 rows results.

Please, take a look at the image, data with 4 level index, and after the last level, Product Name, change, the index is reset.

Tried these, and many similar, formulas, but in vain:

 

MA =
VAR m1=
SUMX(
FILTER(
_2017,
_2017[index2]>_2017[index2]-3 &&
_2017[index2]<=_2017[index2]+1),
_2017[SellingPrice])
VAR m2=
CALCULATE(
SUM(_2017[SellingPrice]),
FILTER(_2017,
SUMX(_2017,
EARLIER(_2017[index2])=_2017[index2] &&
EARLIER(_2017[index2])<=_2017[index2]
)))
RETURN m1

 

 

Would very much appreaciate any help. Thanks!

 

Best, 

LevanpbMovingAverageHelp.png

2 ACCEPTED SOLUTIONS
v-danhe-msft
Employee
Employee

Hi @Anonymous,

Based on my test, you could try this formula:

Column = var a=[index2]-3
return CALCULATE(MAX(_2017[SellingPrice]),FILTER('_2017','_2017'[index2]=a))

Result:

1.PNG

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/ae3sor62pk3mhyt/Moving%20Average%20for%204%20%20level%20indexed%20values.pbix?dl=0

 

Regards,

Daniel He

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

View solution in original post

v-danhe-msft
Employee
Employee

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

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

View solution in original post

4 REPLIES 4
v-danhe-msft
Employee
Employee

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks a lot! and sorry for delayed reply, thought nobody would answer it ever and stopped checking after awhile 🙂

v-danhe-msft
Employee
Employee

Hi @Anonymous,

Based on my test, you could try this formula:

Column = var a=[index2]-3
return CALCULATE(MAX(_2017[SellingPrice]),FILTER('_2017','_2017'[index2]=a))

Result:

1.PNG

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/ae3sor62pk3mhyt/Moving%20Average%20for%204%20%20level%20indexed%20values.pbix?dl=0

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Anybody?

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.