<?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 the intersection of two columns as filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3028489#M103376</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="498754" data-lia-user-login="PKuipers" class="lia-mention lia-mention-user"&gt;PKuipers&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please refer to attached sample file with the proposed solution. In order to obtain correct total for the involved machines further DAX need to be added.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Total Print Time = 
SUMX (
    VALUES ( SeriesTasks[MachineUsed] ),
    VAR CurrentMachine = SeriesTasks[MachineUsed]
    RETURN
        CALCULATE ( 
            SUM ( AllTasks[PrintTime (h)] ),
            AllTasks[Machine] = CurrentMachine,
            ALL ( AllTasks )
        )
)&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 18 Jan 2023 11:42:07 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2023-01-18T11:42:07Z</dc:date>
    <item>
      <title>Calculate with the intersection of two columns as filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3019614#M102678</link>
      <description>&lt;P&gt;I have a model to calculate OEE statistics of a 3D printing plant and I'm trying to incorporate some service data (time spent on repairs).&lt;/P&gt;&lt;P&gt;The service duration needs to be divided by a ratio of time spent on series production and all time spent (including test production)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables, which have a 1:1 relation. I used the RELATED function to copy some data from the first table to the second&lt;/P&gt;&lt;P&gt;AllTasks &amp;lt;-&amp;gt; SeriesTasks&lt;/P&gt;&lt;P&gt;JobID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1:1&amp;nbsp;&amp;nbsp;&amp;nbsp; Job nr&lt;/P&gt;&lt;P&gt;Machine&amp;nbsp;&amp;nbsp; =&amp;gt; MachineUsed (column added with related)&lt;/P&gt;&lt;P&gt;PrintTime [h] =&amp;gt; PrintTime (column added with related)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AllTasks contains a longer list of machines and jobs than SeriesTasks, but alle machines and Jobs of Series tasks can be found in AllTasks (as they are copied from that table). SeriesTasks comes from another source and contains a lot of other production information, so I cannot combine the tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. AllTasks&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;JobID&lt;/TD&gt;&lt;TD&gt;Machine&lt;/TD&gt;&lt;TD&gt;PrintTime [h]&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;G1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;G1&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;G2&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;G3&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;G4&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;G5&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;G7&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;G5&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;G4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;and SeriesTasks&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Job nr&lt;/TD&gt;&lt;TD&gt;MachineUsed = RELATED(Machine)&lt;/TD&gt;&lt;TD&gt;PrintTime = RELATED(PrintTime [h])&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;G1&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;G4&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;G4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate to caculate the total print time of machines used for series production, something like:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;('AllTasks'[PrintTime [h]]]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 'AllTasks'[Machine] = 'SeriesTasks'[MachineUsed]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;The above code does not work.&lt;/P&gt;&lt;P&gt;I have tried things with FILTER, TREATAS and CALCULATETABLE + INTERSECT as I found on this forum, but I can't get anything to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea what I'm missing?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 15:00:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3019614#M102678</guid>
      <dc:creator>PKuipers</dc:creator>
      <dc:date>2023-01-13T15:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with the intersection of two columns as filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3019778#M102692</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="498754" data-lia-user-login="PKuipers" class="lia-mention lia-mention-user"&gt;PKuipers&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;Total Time (Calculated Column) =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( 'AllTasks'[PrintTime [h]]] ),&lt;BR /&gt;'AllTasks'[Machine] = 'SeriesTasks'[MachineUsed],&lt;BR /&gt;REMOVEFILTERS ()&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 16:05:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3019778#M102692</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-13T16:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with the intersection of two columns as filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3021830#M102870</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="498754" data-lia-user-login="PKuipers" class="lia-mention lia-mention-user"&gt;PKuipers&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have created a simple smaple, please refer to it to see if it helps you.&lt;/P&gt;
&lt;P&gt;Create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = CALCULATE(SUM(alltask[PrintTime [h]]]),FILTER(ALL(alltask),alltask[Machine]=SELECTEDVALUE('series task'[MachineUsed = RELATED(Machine)])))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 01:34:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3021830#M102870</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-16T01:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with the intersection of two columns as filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3028251#M103354</link>
      <description>&lt;P&gt;This seems to be a good step into the right direction for me, thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One part did not work for me, as the syntax was not accepted:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;'series task'[MachineUsed = RELATED(Machine)]&lt;/LI-CODE&gt;&lt;P&gt;but I could work around that by adding a related colum that converted machine names, so I could simply apply:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = CALCULATE(SUM(alltask[PrintTime [h]]]),FILTER(ALL(alltask),alltask[Machine]=SELECTEDVALUE('series task'[MachineUsed])))&lt;/LI-CODE&gt;&lt;P&gt;It seems to work well to extract the correct total print time per used machine per month, but for the ones that are not used for series production, and for the sum per month, it returns 0.07.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value might be because of some problem with my data, I can probably find that myself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But why does the measure not sum the total print time of all printers, used for series production, per month? And what can I do to fix that?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 09:50:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3028251#M103354</guid>
      <dc:creator>PKuipers</dc:creator>
      <dc:date>2023-01-18T09:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with the intersection of two columns as filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3028489#M103376</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="498754" data-lia-user-login="PKuipers" class="lia-mention lia-mention-user"&gt;PKuipers&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please refer to attached sample file with the proposed solution. In order to obtain correct total for the involved machines further DAX need to be added.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Total Print Time = 
SUMX (
    VALUES ( SeriesTasks[MachineUsed] ),
    VAR CurrentMachine = SeriesTasks[MachineUsed]
    RETURN
        CALCULATE ( 
            SUM ( AllTasks[PrintTime (h)] ),
            AllTasks[Machine] = CurrentMachine,
            ALL ( AllTasks )
        )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 18 Jan 2023 11:42:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3028489#M103376</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-18T11:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with the intersection of two columns as filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3029923#M103507</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please have a try.&lt;/P&gt;
&lt;P&gt;Create another measure2 based on the [measure]&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_measure2_ = 
var _b = SUMMARIZE('table','table'[job id],"aaa",'table'[measure])
return
IF(HASONEVALUE('table'[job id]),[measure],SUMX(_b,[aaa]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 00:59:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-the-intersection-of-two-columns-as-filter/m-p/3029923#M103507</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-19T00:59:42Z</dc:date>
    </item>
  </channel>
</rss>

