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

DAX: Filter based on property of item in slicer

Hi all, 

 

I've been struggeling with the following for quite a while and I was hoping you guys could help me out. 

 

I am building a report for retail stores in different countries, and with different properties. I would like to compare the sales of store X to stores in the same country, with the same property. So if I filter my report to show the date for store X, it's in the USA and the property is Urban. So I'd like to get the average sales of similar stores, in this case A and Z (see table below) and show it. 

 

How do I do this in DAX? I've tried using SELECTEDVALUE, but if I take a count of the stores, I only get the one for store X. I am completely lost by now. Thanks in advance for your help!!!

 

As for the data: 

 

I have one fact table with sales figures (let's call it Sales) and a measure summing the net sales (called Net Sales) 

And another dimension table with store information, amongst which the country and property info. 

StoreCountryProperty
AUSAUrban
BUSARural
CCanadaRural
XUSAUrban
YCanadaUrban
ZUSAUrban
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: DAX: Filter based on property of item in slicer

Hi @mariebel ,

 

Please check the formula below.

Measure = CALCULATE(AVERAGE('Table'[sales]),FILTER(ALL('Table'),'Table'[Country]=SELECTEDVALUE('Table'[Country])&&'Table'[Property]=SELECTEDVALUE('Table'[Property])&&'Table'[Store]<>SELECTEDVALUE('Table'[Store])))

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

2 REPLIES 2
Highlighted
Super User IV
Super User IV

Re: DAX: Filter based on property of item in slicer

The information you have provided is not making the problem clear to me. Can you please explain with an example. If possible please share a sample pbix file after removing sensitive information.
Thanks.
Proud to be a Datanaut My Recent Blog -Time Intelligence - Direct Query



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Community Support
Community Support

Re: DAX: Filter based on property of item in slicer

Hi @mariebel ,

 

Please check the formula below.

Measure = CALCULATE(AVERAGE('Table'[sales]),FILTER(ALL('Table'),'Table'[Country]=SELECTEDVALUE('Table'[Country])&&'Table'[Property]=SELECTEDVALUE('Table'[Property])&&'Table'[Store]<>SELECTEDVALUE('Table'[Store])))

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors