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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
uniqum47
Frequent Visitor

Calculate Average measure based on the similar age of teams

I feel like it should be an easy solution, but can't quite figure out after hours of googling 😞

 

I have a Team slicer. 

I need to calculate averge for GIQ based on chosen in slicer Team' age +-10 days

Have following data set:

 

OrganisationTeam

TeamAge

GIQ
XAX200168
OB205150
XCX200130
YD150105
XEX195190
ZF50150

 

When we chose Team AX, the answer should be the average of GIQ for (AX, B, CX and EX ) teams.

 

I have been trying DAX, but if there is solution in M - I will be happy to use it too.

 

Thank you!

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression.

mahoneypat_0-1641132722846.png

 

Avg Within 10 =
VAR thisage =
    MIN ( Ages[TeamAge] )
VAR result =
    CALCULATE (
        AVERAGE ( Ages[GIQ] ),
        ALL ( Ages ),
        FILTER (
            ALL ( Ages[TeamAge] ),
            Ages[TeamAge] >= thisage - 10
                && Ages[TeamAge] <= thisage + 10
        )
    )
RETURN
    result

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression.

mahoneypat_0-1641132722846.png

 

Avg Within 10 =
VAR thisage =
    MIN ( Ages[TeamAge] )
VAR result =
    CALCULATE (
        AVERAGE ( Ages[GIQ] ),
        ALL ( Ages ),
        FILTER (
            ALL ( Ages[TeamAge] ),
            Ages[TeamAge] >= thisage - 10
                && Ages[TeamAge] <= thisage + 10
        )
    )
RETURN
    result

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


tex628
Community Champion
Community Champion

Hello @uniqum47,

Try this:

Measure = 
VAR Age = SELECTEDVALUE(Table[TeamAge]
VAR upperlimit = Age + 10
VAR lowerlimit = Age - 10
Return 
AVERAGEX(FILTER(ALL(TABLE), Table[TeamAge] >= lowerlimit && Table[TeamAge] <= upperlimit ) , Table[GIQ] )
 


Let me know how it goes! 

Br, 
J


Connect on LinkedIn

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.