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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
dpc_development
Helper III
Helper III

Calculate average of calculated measure across all dimensions

Please see this uploaded Power BI file. With help from @OwenAuger I have a calculated measure called 'cumulative_return'. I am then calculating another measure called '7d_cumulative_return', which is basically the cumulative_return as on seven days prior to the current last_updated date.

 

Now, I need to calculate the average of 7d_cumulative_return across all lists. You will notice that the values for list 2 & 1027 on the 3rd is 1.051 and 1.085, and on 4th is 0.906 and 0.923, respectively. Thus my new measure should return 1.068 and 0.9145, respectively.

 

This is the formula that I have for now.

 

avg_7d_cumulative_return = 
var onDate = MAX('CMC Daily Return'[last_updated])
RETURN 
CALCULATE(
    AVERAGEX(ALLSELECTED('CMC Daily Return'), [7d_cumulative_return]),
    'CMC Daily Return'[last_updated] <= onDate,
    ALLSELECTED('CMC Daily Return')
)

 

It starts well, but shows a wrong value from the second day onward. How can I get the average of a measure that depends on a dimension, but I need the average across all dimension values.

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi there @dpc_development 

 

To calculate the average of the existing measure [7d_cumulative_return] over the list_id, you can use a measure like below.

This assumes you want to show the same average across all selected list_id values.

avg_7d_cumulative_return = 
AVERAGEX ( 
    ALLSELECTED ( 'CMC Daily Return'[list_id] ),
    [7d_cumulative_return]
)

Since all the logic around date filters is captured in the underlying measures, you don't need to rewrite any date filters in this measure.

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

1 REPLY 1
OwenAuger
Super User
Super User

Hi there @dpc_development 

 

To calculate the average of the existing measure [7d_cumulative_return] over the list_id, you can use a measure like below.

This assumes you want to show the same average across all selected list_id values.

avg_7d_cumulative_return = 
AVERAGEX ( 
    ALLSELECTED ( 'CMC Daily Return'[list_id] ),
    [7d_cumulative_return]
)

Since all the logic around date filters is captured in the underlying measures, you don't need to rewrite any date filters in this measure.

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors