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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Customer who Bought A, what else he bought ?

Hi,

 

I have data similar to below:

 

IDAcquisition QtrPurchase QtrProductAcq Type
119Q119Q1AAt Acq
119Q118Q1BPre Acq
119Q120Q1CPost Acq
219Q219Q2CAt Acq
219Q218Q2BPre Acq
219Q220Q2A

Post Acq

 

I want to answer the following question :

 

1. What products were purchased at the time of Acquisition ? Like above, it is A & C.

2. What products were purchased prior and post acquisition ? For ex : If we select A in step 1, then I should be able to get that B product was purchased pre Acq and C was purchased post Acq.

 

I am new to power BI and DAX, it would be great help if you could provide me with appropriate code / measure or sample pbix file to perform the same.

 

Thanks,

Anshul Bhandari

4 REPLIES 4
Anonymous
Not applicable

// If you want to show the products in
// a table visual, then you have to:
// 1. Create a model table with all the products
//    and name it something like "Post-Acq Prods".
// 2. Create a model table with all the products
//    and name it something like "Pre-Acq Prods".
// 3. Keep them DISCONNECTED.
// 4. Create 2 measures (below).
// 5. Put the two tables' Product columns into
//    2 different table visuals (pre- and post-acq products).
// 6. Set visual filters on the tables using
//    the Filter pane and the 2 measures below
//    (filter by [measure] = 1).
// If you now create a slicer on the products
// from the T table (the one you showed), the two
// table visuals mentioned above will display
// the associated pre- and post-acq products.

[Is Pre-Acq Product?] =
var __acqTypeOfInterest = "pre acq"
// Let's gather all the Pre-Acq
// products that correspond to those
// "At Acq" for the same ID's and
// Acquisition Qtr. Ignore the products
// that are not "At Acq".
var __preAcqProds = 
	CALCULATETABLE(
		VALUES( T[Product] ),
		filter(
			SUMMARIZE(
				T,
				T[ID],
				T[Acquisition Qtr],
				T[Acq Type]
			),
			T[Acq Type] = "at acq"
		),
		T[Acq Type] = __acqTypeOfInterest,
		ALL( T )
	)
var __visiblePreAcqProd =
	SELECTEDVALUE( 'Pre-Acq Product'[Product] )
return
	1 * ( __visiblePreAcqProd in __preAcqProds )
	

[Is Post-Acq Product?] =
var __acqTypeOfInterest = "post acq"
// Let's gather all the Pre-Acq
// products that correspond to those
// "At Acq" for the same ID's and
// Acquisition Qtr. Ignore the products
// that are not "At Acq".
var __postAcqProds = 
	CALCULATETABLE(
		VALUES( T[Product] ),
		filter(
			SUMMARIZE(
				T,
				T[ID],
				T[Acquisition Qtr],
				T[Acq Type]
			),
			T[Acq Type] = "at acq"
		),
		T[Acq Type] = __acqTypeOfInterest,
		ALL( T )
	)
var __visiblePostAcqProd =
	SELECTEDVALUE( 'Post-Acq Product'[Product] )
return
	1 * ( __visiblePostAcqProd in __postAcqProds )

Please note that the above measures are helper measures that should only be used to filter (=1) the rows of a table visual in which products from one of the two tables I mention should be stored.

amitchandak
Super User
Super User

@Anonymous , Create measures like this and use with product or customer and product

 

At Acq= calculate(sum(Table), filter(Table,Table[Acq Type] = " At Acq"))

Pre Acq= calculate(sum(Table), filter(Table,Table[Acq Type] = "Pre Acq"))

Post Acq= calculate(sum(Table), filter(Table,Table[Acq Type] = "Post Acq"))

 

Or you can use a slicer for Acq Type

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
Anonymous
Not applicable

Thanks, But your solution is not giving me appropriate result. I want to create a view where if I select Product A at ACQ, then all the accounts who have purchased Product A at ACQ, and what other products were purchased in Pre Acq and Post Acq by those accounts who were Acquired by Product A at ACQ.

Greg_Deckler
Community Champion
Community Champion

@Anonymous - You could create what is called a slicer visualization on [Acq Type]. When you select things from this slicer your other visuals will filter automatically.



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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.