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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
puck22
Frequent Visitor

Date related total average on every row

Hello.

 

I'm trying to create a measure so I can show which opportunities are older than the average sales cycle on a table.

There is a special condition on my sales cycle measure, that I only calculate it based on the last 90 days, something like this:

 

Sales Cycle = 
CALCULATE(
AVERAGE(Opportunity[Age]),

FILTER(Opportunity,

Opportunity[CloseDate] < TODAY() && Opportunity[CloseDate] >= (TODAY() - 90)
))

 

What I'm having trouble to have the correct result is the average sales cycle for all opportunities in a Table visual, because it is giving me the result only for opportunities that have the close date on the last 90 days (because of the filter, if the filter is not there, the result is the same for every opportunity). Like this:

 

Opportunity  CloseDate  Age  Sales Cycle
A  04/27/2022  67  67
B  01/01/2021  64 
C  02/15/2022  82  83

 

I want to have the same result for every opportunity on their row context, but also need this 90 days interval to be considered on the calculation. What I expect is something like this:

 

Opportunity  CloseDate  Age  Sales Cycle
A  04/27/2022  67  71
B  01/01/2021  64  71
C  02/15/2022  82  71

 

Any ideias how I can achieve this?

1 REPLY 1
v-chenwuz-msft
Community Support
Community Support

Hi @puck22 ,

 

Please try this expression:

Sales =
VAR _s =
    SUMMARIZE (
        FILTER (
            ALLSELECTED ( 'Opportunity'[Opportunity] ),
            Opportunity[CloseDate] < TODAY ()
                && Opportunity[CloseDate]
                    >= ( TODAY () - 90 )
        ),
        [Opportunity],
        "age1", SUM ( Opportunity[Age] )
    )
RETURN
    AVERAGEX ( _s, [age1] )

 

Best Regards

Community Support Team _ chenwu zhu

 

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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