<?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: DAX Measure - Co-occurrences in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Co-occurrences/m-p/4323983#M171666</link>
    <description>&lt;P&gt;You'd need to create a separate table for use in the slicer. You can use&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Product for slicer = DISTINCT( 'Table'[Product] )&lt;/LI-CODE&gt;
&lt;P&gt;Do not connect that to the main table, just use it in the slicer.&lt;/P&gt;
&lt;P&gt;You can then create a measure like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Num co-occurences] = IF(
SELECTEDVALUE('Product for slicer'[Product]) &amp;lt;&amp;gt; SELECTEDVALUE('Table'[Product]),
VAR InvoicesForChosenProduct = CALCULATETABLE(
	VALUES('Table'[Invoice no.]),
	TREATAS(
		VALUES('Product for slicer'[Product]),
		'Table'[Product]
	)
)
VAR InvoicesForCurrentProduct = VALUES('Table'[Invoice no.])
VAR Result = COUNTROWS(INTERSECT(
	InvoicesForChosenProduct,
	InvoicesForCurrentProduct
))
RETURN
	Result
)&lt;/LI-CODE&gt;
&lt;P&gt;and use the [Product] column from the main table in your visual.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2024 13:45:12 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2024-12-11T13:45:12Z</dc:date>
    <item>
      <title>DAX Measure - Co-occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Co-occurrences/m-p/4323774#M171657</link>
      <description>&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;Hi, I'm having trouble coming up with a measurement.&lt;/P&gt;&lt;P&gt;Simple table, 2 columns, Invoice No. and Product. The task is to obtain the result of co-occurrences on one invoice.&lt;BR /&gt;I want to have a slicer with product selection and a table where I add a product column to the rows and this measure to the value. Selecting product 1 in the slicer will show me the remaining products and the number of co-occurrences on one of the invoices.&lt;BR /&gt;for example: let's assume that product 1 appeared on 100 invoices, it will show me that product 2 appeared 50 times out of these 100 invoices, product 3 20 times etc.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Invoice no.&lt;/TD&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;234&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;234&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;345&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;345&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;345&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;456&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;456&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;456&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;456&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Results, after choose Product 1 from slicer&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;Occurreces&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 12:04:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Co-occurrences/m-p/4323774#M171657</guid>
      <dc:creator>Adamkowalsky92</dc:creator>
      <dc:date>2024-12-11T12:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure - Co-occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Co-occurrences/m-p/4323983#M171666</link>
      <description>&lt;P&gt;You'd need to create a separate table for use in the slicer. You can use&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Product for slicer = DISTINCT( 'Table'[Product] )&lt;/LI-CODE&gt;
&lt;P&gt;Do not connect that to the main table, just use it in the slicer.&lt;/P&gt;
&lt;P&gt;You can then create a measure like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Num co-occurences] = IF(
SELECTEDVALUE('Product for slicer'[Product]) &amp;lt;&amp;gt; SELECTEDVALUE('Table'[Product]),
VAR InvoicesForChosenProduct = CALCULATETABLE(
	VALUES('Table'[Invoice no.]),
	TREATAS(
		VALUES('Product for slicer'[Product]),
		'Table'[Product]
	)
)
VAR InvoicesForCurrentProduct = VALUES('Table'[Invoice no.])
VAR Result = COUNTROWS(INTERSECT(
	InvoicesForChosenProduct,
	InvoicesForCurrentProduct
))
RETURN
	Result
)&lt;/LI-CODE&gt;
&lt;P&gt;and use the [Product] column from the main table in your visual.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 13:45:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Co-occurrences/m-p/4323983#M171666</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-12-11T13:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure - Co-occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Co-occurrences/m-p/4324003#M171667</link>
      <description>&lt;P&gt;Great, great, great! Exactly what i want! Thank you so much.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 13:56:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Co-occurrences/m-p/4324003#M171667</guid>
      <dc:creator>Adamkowalsky92</dc:creator>
      <dc:date>2024-12-11T13:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure - Co-occurrences</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Co-occurrences/m-p/4324437#M171690</link>
      <description>&lt;P&gt;It's solved already when I saw it; but just for fun only, I provide a more sophisticated solution applicable to a more generic model. What's more an intricacy of it is that when more products selected in the slicer (ie, product 1&amp;amp;2), only those invoices (invoice 123 &amp;amp; 456) containing all selected products will be further investigated for co-existing products (product 3&amp;amp;4).&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 18:41:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Co-occurrences/m-p/4324437#M171690</guid>
      <dc:creator>ThxAlot</dc:creator>
      <dc:date>2024-12-11T18:41:01Z</dc:date>
    </item>
  </channel>
</rss>

