<?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: Calculate with multiple criteria in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/909144#M8634</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="197006" data-lia-user-login="lyonslat" class="lia-mention lia-mention-user"&gt;lyonslat&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create below measure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Flag = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var food=CALCULATE(COUNT(Sheet1[profit_center_id]),allexcept(Sheet1,Sheet1[profit_center_id]),Sheet1[revenue_category_name]="FOOD")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Var beer=CALCULATE(COUNT(Sheet1[profit_center_id]),allexcept(Sheet1,Sheet1[profit_center_id]),Sheet1[revenue_category_name]="BEER")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF(food&amp;gt;0 &amp;amp;&amp;amp; beer&amp;gt;0,1,0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;And add this measure to visual level filter of table and set it to 1.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks &amp;amp; regards,&lt;BR /&gt;Pravin Wattamwar&lt;BR /&gt;&lt;A href="http://www.linkedin.com/in/pravin-p-wattamwar" target="_blank"&gt;www.linkedin.com/in/pravin-p-wattamwar&lt;/A&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;STRONG&gt;If I resolve your problem Mark it as a solution and give kudos.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 23 Jan 2020 08:39:03 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-01-23T08:39:03Z</dc:date>
    <item>
      <title>Calculate with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/906771#M8532</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First post, so apologies if it doesn't make a huge amount of sense, but I'm really hoping someone can help me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Relatively new to DAX, but very familiar with Excel, so most of my logical thinking (&amp;amp; language) comes from there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I need to count the number of distinct transactions...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Transactions = 
DISTINCTCOUNT('Event1'[check_number])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...that contain "Food" AND "Beer".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data I have is formatted in the following table:&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;profit_center_id&lt;/TD&gt;&lt;TD&gt;Profit_center_name&lt;/TD&gt;&lt;TD&gt;check_number&lt;/TD&gt;&lt;TD&gt;revenue_category_name&lt;/TD&gt;&lt;TD&gt;ItemQty&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;M1 Food&lt;/TD&gt;&lt;TD&gt;123456&lt;/TD&gt;&lt;TD&gt;Food&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;M1 Food&lt;/TD&gt;&lt;TD&gt;123456&lt;/TD&gt;&lt;TD&gt;Beer&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;M1 Food&lt;/TD&gt;&lt;TD&gt;123456&lt;/TD&gt;&lt;TD&gt;Misc&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;M2 Beer&lt;/TD&gt;&lt;TD&gt;234567&lt;/TD&gt;&lt;TD&gt;Food&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;M3 Beer&lt;/TD&gt;&lt;TD&gt;345678&lt;/TD&gt;&lt;TD&gt;Beer&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;M3 Beer&lt;/TD&gt;&lt;TD&gt;345678&lt;/TD&gt;&lt;TD&gt;Food&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need more than this, but if I have an answer to this, I can figure the rest out!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 16:06:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/906771#M8532</guid>
      <dc:creator>lyonslat</dc:creator>
      <dc:date>2020-01-21T16:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/906848#M8533</link>
      <description>Calculate (Distinctcount(table[column]),filter(table,containstring(table[columm_name],"food") || containstring(table[columm_name],"beer")))&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Pravin&lt;BR /&gt;&lt;BR /&gt;If it resolves your problem mark it as a solution and give Kudos</description>
      <pubDate>Tue, 21 Jan 2020 17:22:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/906848#M8533</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-21T17:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/908200#M8587</link>
      <description>&lt;P&gt;Hi Pravin,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your input, it's much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunatley this didn't quite work the way I expected it to.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result I'm looking for is to show the number of transactions that contain both Food and Beer. The result that your suggestion put forward, gives me a number of the transactions that contain either food or beer and totals them up.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ben&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 16:14:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/908200#M8587</guid>
      <dc:creator>lyonslat</dc:creator>
      <dc:date>2020-01-22T16:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/908233#M8589</link>
      <description>&lt;P&gt;The best way I can describe this is if you imagine a venn diagram of transactions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One side has food transactions, the other has beer, and in the middle you have the number of distinct transactions that contain both food and beer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 16:38:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/908233#M8589</guid>
      <dc:creator>lyonslat</dc:creator>
      <dc:date>2020-01-22T16:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/909144#M8634</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="197006" data-lia-user-login="lyonslat" class="lia-mention lia-mention-user"&gt;lyonslat&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create below measure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Flag = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var food=CALCULATE(COUNT(Sheet1[profit_center_id]),allexcept(Sheet1,Sheet1[profit_center_id]),Sheet1[revenue_category_name]="FOOD")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Var beer=CALCULATE(COUNT(Sheet1[profit_center_id]),allexcept(Sheet1,Sheet1[profit_center_id]),Sheet1[revenue_category_name]="BEER")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF(food&amp;gt;0 &amp;amp;&amp;amp; beer&amp;gt;0,1,0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;And add this measure to visual level filter of table and set it to 1.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks &amp;amp; regards,&lt;BR /&gt;Pravin Wattamwar&lt;BR /&gt;&lt;A href="http://www.linkedin.com/in/pravin-p-wattamwar" target="_blank"&gt;www.linkedin.com/in/pravin-p-wattamwar&lt;/A&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;STRONG&gt;If I resolve your problem Mark it as a solution and give kudos.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Jan 2020 08:39:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/909144#M8634</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-23T08:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with multiple criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/909429#M8641</link>
      <description>&lt;P&gt;You could use INTERSECT in the following&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MeasureFoodAndBeer = 
VAR _FoodChecks = CALCULATETABLE (VALUES ( TableBill[check_number] ), TableBill[revenue_category_name] = "Beer")
VAR _BeerChecks = CALCULATETABLE (VALUES ( TableBill[check_number] ), TableBill[revenue_category_name] = "Food")

RETURN
 COUNTROWS(INTERSECT(_BeerChecks, _FoodChecks))&lt;/LI-CODE&gt;&lt;P&gt;If you want to break this down and test it, you can materialise each of the tables by creating a table (New Table) with the CALCULATETABLE code. You can then look at the table in data view.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 12:27:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-multiple-criteria/m-p/909429#M8641</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2020-01-23T12:27:23Z</dc:date>
    </item>
  </channel>
</rss>

