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
FRG
Resolver I
Resolver I

Sum of average by week

Hello,

In my report I created a measure to calculate the average of the 2 best weeks of purchase in the last few years, which it works.

 

Opt = 
var wt = year(today())*100+weeknum(TODAY(),1)
return  if (SELECTEDVALUE(DimDate[Year/week])<wt,BLANK(),
 var w= SELECTEDVALUE(DimDate[#Week])
 var a= SUMMARIZE(FILTER(ALL(DimDate),DimDate[#Week]=w),DimDate[Date].[Année],"Purch",[Purchase])
  var b = topn(2,a,[Purch],DESC)
 return AVERAGEX(b,[Purch]))

 

Now I need a measure to sum these average like this.

FRG_0-1655829490138.png

 

How can I acheive this?

Thank you

 

PBIX file:

https://www.dropbox.com/s/6p0a7wgs23uwq3z/Test_purchase.pbix?dl=0 

2 REPLIES 2
Seanan
Solution Supplier
Solution Supplier

Hi @FRG,

 

This post here might be able to help you achieve the cumulative sum that you are looking for.

 

If this helped you solve your problem, please mark it as the solution.

Kind regards,
Seanan.

Hello, thanks for the reply.
I can't create a calculated table to achieve this because I have to many thing that can filter the result. I'm still searching for a calculated measure.

Thank you

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.