Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Store | Country | Property |
A | USA | Urban |
B | USA | Rural |
C | Canada | Rural |
X | USA | Urban |
Y | Canada | Urban |
Z | USA | Urban |
Solved! Go to Solution.
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.
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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
77 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |