<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Customer who Bought A, what else he bought ? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1361288#M24661</link>
    <description>&lt;LI-CODE lang="csharp"&gt;// 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 )&lt;/LI-CODE&gt;&lt;P&gt;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.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Sep 2020 11:45:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-09-10T11:45:22Z</dc:date>
    <item>
      <title>Customer who Bought A, what else he bought ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1359245#M24595</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data similar to below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Acquisition Qtr&lt;/TD&gt;&lt;TD&gt;Purchase Qtr&lt;/TD&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;Acq Type&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;19Q1&lt;/TD&gt;&lt;TD&gt;19Q1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;At Acq&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;19Q1&lt;/TD&gt;&lt;TD&gt;18Q1&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Pre Acq&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;19Q1&lt;/TD&gt;&lt;TD&gt;20Q1&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;Post Acq&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;19Q2&lt;/TD&gt;&lt;TD&gt;19Q2&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;At Acq&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;19Q2&lt;/TD&gt;&lt;TD&gt;18Q2&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Pre Acq&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;19Q2&lt;/TD&gt;&lt;TD&gt;20Q2&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Post Acq&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to answer the following question :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. What products were purchased at the time of Acquisition ? Like above, it is A &amp;amp; C.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anshul Bhandari&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 19:53:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1359245#M24595</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-09T19:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Customer who Bought A, what else he bought ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1359444#M24606</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;- 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.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 20:27:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1359444#M24606</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-09T20:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Customer who Bought A, what else he bought ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1359972#M24627</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , Create measures like this and use with product or customer and product&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At Acq= calculate(sum(Table), filter(Table,Table[Acq Type] = " At Acq"))&lt;/P&gt;
&lt;P&gt;Pre Acq= calculate(sum(Table), filter(Table,Table[Acq Type] = "Pre Acq"))&lt;/P&gt;
&lt;P&gt;Post Acq= calculate(sum(Table), filter(Table,Table[Acq Type] = "Post Acq"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can use a slicer for Acq Type&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 02:49:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1359972#M24627</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-10T02:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Customer who Bought A, what else he bought ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1360392#M24634</link>
      <description>&lt;P&gt;Thanks, But your solution is&amp;nbsp;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.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 06:31:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1360392#M24634</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-10T06:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Customer who Bought A, what else he bought ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1361288#M24661</link>
      <description>&lt;LI-CODE lang="csharp"&gt;// 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 )&lt;/LI-CODE&gt;&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 11:45:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Customer-who-Bought-A-what-else-he-bought/m-p/1361288#M24661</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-10T11:45:22Z</dc:date>
    </item>
  </channel>
</rss>

