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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.