cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ad12114 Frequent Visitor
Frequent Visitor

Average based on related value to selected

Hi everyone

 

I have a data set that looks like the below. 

 

What I'm after is to be able to display the average price for the location in which the selected customer resides. In an ideal world I'd have a slicer in which an end user can select e.g. "Joe Bloggs" and then have a measure into a card which would display the average price of people in London, e.g. £163.75.

 

Hoping someone can help with what this measure would look like as I'm a bit stuck!

 

Thanks

 

Customer NameLocationPrice
Joe BloggsLondon£100.00
Dan SmithNewcastle£50.00
Susie CampbellNewcastle£78.00
Kylie MinogueBrighton£135.00
David BeckhamLondon£180.00
Theresa MayLondon£250.00
BeyonceLondon£125.00

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Average based on related value to selected

@ad12114 try this measure

 

Avg = 
VAR __location = MAX( Table2[Location] )
RETURN
CALCULATE( AVERAGE( Table2[Price] ),ALL(Table2 ), Table2[Location] = __location )




Did I answer your question? Mark my post as a solution!


Proud to be a Datanaut! Connect with me on Linkedin.
Feel free to email me with any of your BI needs.




 




2 REPLIES 2
Super User
Super User

Re: Average based on related value to selected

@ad12114 try this measure

 

Avg = 
VAR __location = MAX( Table2[Location] )
RETURN
CALCULATE( AVERAGE( Table2[Price] ),ALL(Table2 ), Table2[Location] = __location )




Did I answer your question? Mark my post as a solution!


Proud to be a Datanaut! Connect with me on Linkedin.
Feel free to email me with any of your BI needs.




 




ad12114 Frequent Visitor
Frequent Visitor

Re: Average based on related value to selected

Thank you!!