<?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: SUMMARIZE returning errors (cannot convert to scalar value) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2156129#M49802</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="150936" data-lia-user-login="PaulOlding" class="lia-mention lia-mention-user"&gt;PaulOlding&lt;/a&gt;&amp;nbsp; Aha, that worked, thank you so much!! I guess I need to learn more about the VAR function.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Oct 2021 15:00:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-10-26T15:00:20Z</dc:date>
    <item>
      <title>SUMMARIZE returning errors (cannot convert to scalar value)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2155702#M49782</link>
      <description>&lt;P&gt;I have an employee directory that lists every employee in the company, along with the office they are assigned to. I need to provide a measure that tells us what percentage of our offices have 10 or more employees, but this is proving to be much more complicated than I anticipated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying to identify how many offices have 10 or more employees didn't work because I can't figure out how to count employees &lt;EM&gt;by office&lt;/EM&gt;:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;STRONG&gt;# Offices with 10 or more employees = &lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[# Active Employees]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;=&lt;/SPAN&gt;&lt;SPAN&gt;10&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Employee Directory'[Office - Assigned]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;This just returns a count of offices, because it's evaluating whether the whole company has 10 or more employees&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I realized&amp;nbsp;I probably need a summarized table where it's giving me each office and the employee count, but am getting consistent errors every time I try to use the GROUPBY or SUMMARIZE function:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;STRONG&gt;Employees per office = &lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Employee Directory'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Employee Directory'[Office - Assigned]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;"# per office"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;COUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Employee Directory'[EmployeeID]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returns the error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value". I've tried changing that last COUNT expression to simply using the measure "# Active Employees", and I get the same error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried a GROUPBY:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;# employees by office =&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;GROUPBY&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Employee Directory'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Employee Directory'[Office - Assigned]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"# per office"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;sumx&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;CURRENTGROUP&lt;/SPAN&gt;&lt;SPAN&gt;(),&lt;/SPAN&gt;&lt;SPAN&gt;'Employee Directory'[# Active Employees]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and got the same "scalar" error.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;We only have 14 offices, 6 of which have 10 or more employees, so this isn't giant complex data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing here? Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 11:40:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2155702#M49782</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-26T11:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: SUMMARIZE returning errors (cannot convert to scalar value)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2155786#M49785</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Are you creating a measure or a calculated column. You most likely want a measure.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 12:18:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2155786#M49785</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-10-26T12:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: SUMMARIZE returning errors (cannot convert to scalar value)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2156026#M49797</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp; I've tried both, get the same error each time:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is when I tried it as a column. Same error. I don't understand why it thinks I'm referencing multiple columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 13:58:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2156026#M49797</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-26T13:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: SUMMARIZE returning errors (cannot convert to scalar value)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2156083#M49800</link>
      <description>&lt;P&gt;The SUMMARIZE function returns a table, but measures must return scalar values.&amp;nbsp; That's why you get the error.&lt;/P&gt;
&lt;P&gt;Here's a measure to get the number of offices with more than 10 employees&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Offices &amp;gt;10 Employees = 
VAR _SelectedNumEmployees = 10
VAR _Result = 
COUNTROWS(
    FILTER(
        VALUES('Employee Directory'[Office - Assigned]),
        CALCULATE(COUNT('Employee Directory'[Employee ID])) &amp;gt; _SelectedNumEmployees
    )
)
RETURN
    _Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could replace&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;CALCULATE(COUNT('Employee Directory'[Employee ID])) in the above with a measure that counts number of employees.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 14:34:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2156083#M49800</guid>
      <dc:creator>PaulOlding</dc:creator>
      <dc:date>2021-10-26T14:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: SUMMARIZE returning errors (cannot convert to scalar value)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2156129#M49802</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="150936" data-lia-user-login="PaulOlding" class="lia-mention lia-mention-user"&gt;PaulOlding&lt;/a&gt;&amp;nbsp; Aha, that worked, thank you so much!! I guess I need to learn more about the VAR function.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 15:00:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMMARIZE-returning-errors-cannot-convert-to-scalar-value/m-p/2156129#M49802</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-26T15:00:20Z</dc:date>
    </item>
  </channel>
</rss>

