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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
DimaMD
Solution Sage
Solution Sage

Related products in Checks

Hello Community
I have a table of receipts containing: date, receipt ID, product ID, amount, and quantity of goods sold.
One receipt can contain several items, for example.
Receipt with identification number M00012 contains the following goods: identification numbers 21, 22, 25, 26. Such

There can be many such receipts, and they may contain identical items.
In the visual matrix, I display the receipt ID, amount, and quantity.
Now I sort by amount and see which product was purchased the most, and now my task in another visualization is to see which products were related in those receipts where the product I highlighted in the matrix table was.

PBIX file example 


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You need to make some changes to the model. You need 2 copies of a product table, which is just the distinct product IDs. You'll use one in the matrix and the other in the slicer. Create a relationship from the one for the matrix to the sales table, leave the slicer version disconnected from everything.

You can then create a calculation group to apply the same related receipts logic to any measure, with a calculation item like

Show Related Receipts = 
VAR Receipts = CALCULATETABLE( 
    VALUES( 'sales table'[Receipt ID] ), 
    TREATAS( VALUES( 'Product for Slicer'[Product ID] ), 'sales table'[Product ID] ),
    REMOVEFILTERS( 'Product' )
)
VAR Result = CALCULATE( SELECTEDMEASURE(), KEEPFILTERS( Receipts ) )
RETURN Result

Apply this calculation item as a filter to the matrix and that will then show all products which appear in receipts which also contain the product you select in the slicer.

See the attached PBIX for reference.

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

You need to make some changes to the model. You need 2 copies of a product table, which is just the distinct product IDs. You'll use one in the matrix and the other in the slicer. Create a relationship from the one for the matrix to the sales table, leave the slicer version disconnected from everything.

You can then create a calculation group to apply the same related receipts logic to any measure, with a calculation item like

Show Related Receipts = 
VAR Receipts = CALCULATETABLE( 
    VALUES( 'sales table'[Receipt ID] ), 
    TREATAS( VALUES( 'Product for Slicer'[Product ID] ), 'sales table'[Product ID] ),
    REMOVEFILTERS( 'Product' )
)
VAR Result = CALCULATE( SELECTEDMEASURE(), KEEPFILTERS( Receipts ) )
RETURN Result

Apply this calculation item as a filter to the matrix and that will then show all products which appear in receipts which also contain the product you select in the slicer.

See the attached PBIX for reference.

@johnt75 Hi, I am very grateful for this decision; it is the result I was hoping for.


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
SamWiseOwl
Super User
Super User

Hi @DimaMD 

 

In your example file you have the product not the receiptID in the matrix.
Add the ReceiptID into the Matrix and it should work as you describe:

SamWiseOwl_1-1755171159192.png

 

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Hi, @SamWiseOwl 
Thank you for your reply, but the logic is to see all the goods that were sold during the selected period. Sorry, I specified the order incorrectly. The first table shows the product ID, amount, and quantity, and when I click on any product in the other table, it should display all the products that were in all receipts where this product was sold.

DimaMD_1-1755182251639.png

 

DimaMD_0-1755182218373.png

 


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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