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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

How to get products which are bought the most along with the selected product/ product category

I have a dataset with columns

Item no, Transaction no, Category

 

There are 2 filters for Caegory and item. IF I select a Category named "Biscuits".

So a table must show all the items that have been bought along (Along in the sense bought in a same transaction) with any item belonging to the category "Biscuits".

Like if the dataset is:

 

item       trn no         category

A                1               Biscuits

B               1               Chocolates

A                2              Biscuits

C                3              Drinks

B                4              Chocolates

E                4              Biscuits

F                4              Vegetable

G                5              Biscuits

A                5               Biscuits

 

If I select Biscuits in category filter it should show

item      No of times bought

B             2

F              1

G             1

 

If I select B in item filter it should show all items bought along with item B

item      No of times bought

A            1

E             1

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You need to have an independent table for category and item for slicer

 

new measure =
var _tab = summarize(filter(Table, Table[category] in allselected(category[category])),[trn no])
return
calculate(count(Table[Trn no]), filter(Table, Table[Trn no] in _tab))


new measure 1 =
var _tab = summarize(filter(Table, Table[item] in allselected(item[item])),[trn no])
return
calculate(count(Table[Trn no]), filter(Table, Table[Trn no] in _tab))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , You need to have an independent table for category and item for slicer

 

new measure =
var _tab = summarize(filter(Table, Table[category] in allselected(category[category])),[trn no])
return
calculate(count(Table[Trn no]), filter(Table, Table[Trn no] in _tab))


new measure 1 =
var _tab = summarize(filter(Table, Table[item] in allselected(item[item])),[trn no])
return
calculate(count(Table[Trn no]), filter(Table, Table[Trn no] in _tab))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.