<?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 Filter on multiple columns in a measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-multiple-columns-in-a-measure/m-p/2993999#M100816</link>
    <description>&lt;P&gt;I am new to DAX and appreciate your patience if this is a mundane question. Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm writing two measures, one to filter for projects that were overdue when completed, and one to filter for projects completed before their deadline. These measures will be used to create a stacked column chart of projects completed each quarter throughout the year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will use the example of overdue projects. This is my measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;OverdueProjects = 
FILTER(Projects, 
    Projects[ProjectStatus] = "Done"
    &amp;amp;&amp;amp; Projects[TimeDiff] &amp;lt; 0
)&lt;/LI-CODE&gt;&lt;P&gt;I get the error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, Projects[TimeDiff] refers to another measure that is calculating the difference between the promised execution time for the project, and the actual execution time, so if TimeDiff is negative, it indicates the project is late. I'm not sure if referring to another measure might be what is causing the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code to evaluate TimeDiff:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Time Promised = 
--Time between date created and promise date
CALCULATE(
    INT(
        SUMX(Projects, Projects[PromiseDate] - Projects[StartDate])
    ),
    Projects[ProjectStatus] = "Done" 
    &amp;amp;&amp;amp; Projects[PromiseDate] &amp;lt;&amp;gt; BLANK()
)


Time Delivered = 
-- Time between date created and date completed
CALCULATE(
    INT(
        SUMX(Projects, Projects[DoneDate] - Projects[StartDate])
    ),
    Projects[ProjectStatus] = "Done"
)


TimeDiff = [Time Promised] - [Time Delivered]&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 29 Dec 2022 22:08:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-12-29T22:08:15Z</dc:date>
    <item>
      <title>Filter on multiple columns in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-multiple-columns-in-a-measure/m-p/2993999#M100816</link>
      <description>&lt;P&gt;I am new to DAX and appreciate your patience if this is a mundane question. Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm writing two measures, one to filter for projects that were overdue when completed, and one to filter for projects completed before their deadline. These measures will be used to create a stacked column chart of projects completed each quarter throughout the year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will use the example of overdue projects. This is my measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;OverdueProjects = 
FILTER(Projects, 
    Projects[ProjectStatus] = "Done"
    &amp;amp;&amp;amp; Projects[TimeDiff] &amp;lt; 0
)&lt;/LI-CODE&gt;&lt;P&gt;I get the error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, Projects[TimeDiff] refers to another measure that is calculating the difference between the promised execution time for the project, and the actual execution time, so if TimeDiff is negative, it indicates the project is late. I'm not sure if referring to another measure might be what is causing the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code to evaluate TimeDiff:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Time Promised = 
--Time between date created and promise date
CALCULATE(
    INT(
        SUMX(Projects, Projects[PromiseDate] - Projects[StartDate])
    ),
    Projects[ProjectStatus] = "Done" 
    &amp;amp;&amp;amp; Projects[PromiseDate] &amp;lt;&amp;gt; BLANK()
)


Time Delivered = 
-- Time between date created and date completed
CALCULATE(
    INT(
        SUMX(Projects, Projects[DoneDate] - Projects[StartDate])
    ),
    Projects[ProjectStatus] = "Done"
)


TimeDiff = [Time Promised] - [Time Delivered]&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 29 Dec 2022 22:08:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-multiple-columns-in-a-measure/m-p/2993999#M100816</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-29T22:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Filter on multiple columns in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-multiple-columns-in-a-measure/m-p/2994026#M100821</link>
      <description>&lt;P&gt;hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try like:&lt;/P&gt;&lt;P&gt;OverdueProjects =&lt;BR /&gt;COUNTROWS(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; FILTER(Projects,&lt;BR /&gt;Projects[ProjectStatus] = "Done"&lt;BR /&gt;&amp;amp;&amp;amp; [TimeDiff] &amp;lt; 0&lt;BR /&gt;))&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 22:57:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-multiple-columns-in-a-measure/m-p/2994026#M100821</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-12-29T22:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Filter on multiple columns in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-multiple-columns-in-a-measure/m-p/2994895#M100876</link>
      <description>&lt;P&gt;Thanks very much!&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 13:49:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-on-multiple-columns-in-a-measure/m-p/2994895#M100876</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-30T13:49:30Z</dc:date>
    </item>
  </channel>
</rss>

