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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.