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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
javierzamb
Frequent Visitor

Filtering sales table with all article sales only from stores with specific article selection

Dear Power BI community,

 

I have a Sales table with columns of Stores, Article, Month and Sales, I also have the corresponding dimension tables for Stores and Articles. I would like to measure the performance of specific articles, but only considering the sales from the stores that actually sells those articles. So I need to keep the sales from all articles, from that subset of stores.

 

Here is an example...

My data (very simplified) looks like this:

StoreArticleMonthSales
DowntownSodaJanuary10
DowntownChipsJanuary25
DowntownCandyJanuary32
DowntownMilkJanuary23
SouthChipsJanuary65
SouthCandyJanuary27
SouthMilkJanuary28
SouthCookiesJanuary38
NorthSodaJanuary2
NorthCandyJanuary40
NorthMilkJanuary13
NorthJuiceJanuary11
WestSodaJanuary23
WestChipsJanuary34
WestCandyJanuary45

 

Let's say I choose in a slicer the Articles "Juice" and "Cookies". Those two articles have sales in stores "South" and "North", so I would expect to get a table like this:

StoreArticleMonthSales
SouthChipsJanuary65
SouthCandyJanuary27
SouthMilkJanuary28
SouthCookiesJanuary38
NorthSodaJanuary2
NorthCandyJanuary40
NorthMilkJanuary13
NorthJuiceJanuary

11

 

The Article selection must be dynamic to see the sales f

 

How can I do this in Power BI? I've been trying for hours trying to create new tables, but I haven't been successful.

 

Thank you so much in advance for the help.

 

 

1 ACCEPTED SOLUTION

Hi javierzamb,

 

You need to create a seperate dimension with both Stores and articles, connect it with store dimension (with both sided relationship) in order to do so

 

Store-Article Dimension:

Daniel_PowerBI_0-1697845545435.png

 

and the relationships:

Daniel_PowerBI_1-1697845595063.png

 

and then you can add a slicer with the article column of the Store-Article Dimension to get your result:

Daniel_PowerBI_2-1697845710519.png

 

View solution in original post

4 REPLIES 4
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

 

My initial approach was something "similar" calculating a table, but this one actually works! I still need to test it when using huge tables, but looks promising. Thanks!

Hi javierzamb,

 

You need to create a seperate dimension with both Stores and articles, connect it with store dimension (with both sided relationship) in order to do so

 

Store-Article Dimension:

Daniel_PowerBI_0-1697845545435.png

 

and the relationships:

Daniel_PowerBI_1-1697845595063.png

 

and then you can add a slicer with the article column of the Store-Article Dimension to get your result:

Daniel_PowerBI_2-1697845710519.png

 

Didn't think about this approach. I just tested it with the real databases and works great. Thanks!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.