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

DAX Challenge

Hi

 

I'm working on a project where I'll have to find the Number of times a Product has been upsold. For Example, If you buy a car, the sales man will pursue you to buy accesories like All Weather Mats, Roof Rail.. etc. I need to find out how many times All Weather mats are upsold with the particular Car, Like Wise for other accesories as well.

 

Sales Table:

Order#Customer#Item#Sales$
1ABCITM A100
1ABCITM B20
2BCDITM A100
2BCDITM C15
2BCDITM D20
3DEFITM X200
3DEFITM Y20
4FGHITM A100
4FGHITM C15
    

 

Upselling Part Detail

 

Master ProdutUpsellable Product
ITM AITM B
ITM AITM C
ITM XITM Y
  

 

Final Report Will Look SOmething Like this

Report Filter:  Master Product : ITM A

Total Orders: 3

 

Upsold Product# Of Orders% Upsold ( Total Order of ITM <> / Total Order)
ITM B11/3 = 33%
ITM C22/3 = 66%
   

 

Any Help is much appreciated.

Thanks

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@Anonymous Probably something like:

 

Measure = 
  VAR __Upsold = MAX('Table2'[Upsellable Product])
  VAR __MasterProducts = DISTINCT(SELECTCOLUMNS(FILTER('Table2',[Upsellable Product]=__Upsold),"Master",[Master Product]))
  VAR __Table1 = SELECTCOLUMNS(FILTER('Table1',[Item#] = __Upsold),"Order#",[Order#])
  VAR __Table2 = SELECTCOLUMNS(FILTER('Table1',[Item#] IN __MasterProducts),"Order#",[Order#])
RETURN
  COUNTROWS(INTERSECT(__Table1,__Table2)) / COUNTROWS(__Table1)
  

 

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

amitchandak
Super User
Super User
2 REPLIES 2
amitchandak
Super User
Super User

Greg_Deckler
Community Champion
Community Champion

@Anonymous Probably something like:

 

Measure = 
  VAR __Upsold = MAX('Table2'[Upsellable Product])
  VAR __MasterProducts = DISTINCT(SELECTCOLUMNS(FILTER('Table2',[Upsellable Product]=__Upsold),"Master",[Master Product]))
  VAR __Table1 = SELECTCOLUMNS(FILTER('Table1',[Item#] = __Upsold),"Order#",[Order#])
  VAR __Table2 = SELECTCOLUMNS(FILTER('Table1',[Item#] IN __MasterProducts),"Order#",[Order#])
RETURN
  COUNTROWS(INTERSECT(__Table1,__Table2)) / COUNTROWS(__Table1)
  

 

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.