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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
CuriousFlee
Frequent Visitor

Two Aggregations: Cumulative Sum of Averages Per Category Per Date

Good morning,

 

Have the following underlying data:

sedolreturnsregionsector1date
20263611.5North AmericaFinancials01/06/2023
20024791.2North AmericaIT01/06/2023
28318111.1EuropeIT01/06/2023
2002305-2EuropeFinancials01/06/2023
B92SR70-3APACMaterials01/06/2023
2026361-1North AmericaFinancials02/06/2023
2002479-2North AmericaIT02/06/2023
28318113EuropeIT02/06/2023
20023052EuropeFinancials02/06/2023
B92SR701APACMaterials02/06/2023
20263610North AmericaFinancials03/06/2023
20024790.5North AmericaIT03/06/2023
28318110.1EuropeIT03/06/2023
2002305-5EuropeFinancials03/06/2023
B92SR702APACMaterials03/06/2023

 

Requirement:

  • aggregate it in the following manner: first get the average return for a day for region and then add cumulative sum of it.
  • aggregation should be reactive and respond to external explicit filters (slicers etc)

Sample of output:

regiondateaverage_rets_per_daycum_rets
APAC01/06/2023-3.00-3.00
APAC02/06/20231.00-2.00
APAC03/06/20232.000.00
Europe01/06/2023-0.45-0.45
Europe02/06/20232.502.05
Europe03/06/2023-2.45-0.40
North America01/06/20231.351.35
North America02/06/2023-1.50-0.15
North America03/06/20230.250.10

 

Can achieve individual tasks (eg running sum, calc averages) but struggling to get everythign together in responsive output.

Help is very much appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @CuriousFlee ,

I have created a simple sample, please refer to see if it helps you.

Create 2 measures.

Measure = 
CALCULATE(AVERAGE('Table'[returns]),FILTER(ALL('Table'),'Table'[region]=SELECTEDVALUE('Table'[region])&&'Table'[date]=SELECTEDVALUE('Table'[date])))
Measure 2 = 
var tmp=WINDOW(1,abs,0,REL,ALLSELECTED('Table'[date],'Table'[region]),,,PARTITIONBY('Table'[region]))
return
SUMX(tmp,[Measure])

vrongtiepmsft_0-1716437229016.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

2 REPLIES 2
CuriousFlee
Frequent Visitor

v-rongtiep-msft, this is absolutely brilliant. Had a feeling window function must be involved, but you've just nailed. 

Great suggestion, thanks!

Anonymous
Not applicable

Hi @CuriousFlee ,

I have created a simple sample, please refer to see if it helps you.

Create 2 measures.

Measure = 
CALCULATE(AVERAGE('Table'[returns]),FILTER(ALL('Table'),'Table'[region]=SELECTEDVALUE('Table'[region])&&'Table'[date]=SELECTEDVALUE('Table'[date])))
Measure 2 = 
var tmp=WINDOW(1,abs,0,REL,ALLSELECTED('Table'[date],'Table'[region]),,,PARTITIONBY('Table'[region]))
return
SUMX(tmp,[Measure])

vrongtiepmsft_0-1716437229016.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.