<?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: If/Then logic to create a table in DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2530085#M70933</link>
    <description>&lt;P&gt;Thanks.&amp;nbsp; What I am trying to do is identify the type of user logged in when using RLS and then have the table populated for one type of user (non-CSS) and empty for the other (CSS).&amp;nbsp; The booloean is used only to identify which it is when the user is logged in, and then would create the table with data or empty.&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2022 17:45:30 GMT</pubDate>
    <dc:creator>jflipse</dc:creator>
    <dc:date>2022-05-20T17:45:30Z</dc:date>
    <item>
      <title>If/Then logic to create a table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2529944#M70916</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a table dynamically based on the value of a measure, in this case boolean measure IsCSS.&amp;nbsp; Here is the DAX I used to test out the concent.&amp;nbsp; I am getting the "...expression refers to multiple columns.&amp;nbsp; Multiple columns cannot be converted to a scalar value." error.&amp;nbsp; I am choosing to create this as a table under Modeling &amp;gt;&amp;gt; New Table, so I am not sure why it thinks I am returning a single value measure when I am trying to return a table.&amp;nbsp; Any thoughts would be greatly appreciated.&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TestTable = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;//test if an IF statement can coexist with a CALCULATETABLE statement&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR Tbl1 = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;IF([IsCSS] = TRUE(), &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CALCULATETABLE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;'Home Care',&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;'Home Care'[PHY_NPI]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CALCULATETABLE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;'Home Care',&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;'Home Care'[Physician Name]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Tbl1&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 16:20:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2529944#M70916</guid>
      <dc:creator>jflipse</dc:creator>
      <dc:date>2022-05-20T16:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: If/Then logic to create a table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2529984#M70920</link>
      <description>&lt;P&gt;It's not good practice to use a measure in a calculated column or calculated table.&lt;/P&gt;
&lt;P&gt;I don't know if this is just an exercise but maybe there's another solution to the issue you're trying to solve&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 16:45:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2529984#M70920</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2022-05-20T16:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: If/Then logic to create a table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2530069#M70928</link>
      <description>&lt;P&gt;Adding to what's already been said by&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="81111" data-lia-user-login="HotChilli" class="lia-mention lia-mention-user"&gt;HotChilli&lt;/a&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You cannot return a table from IF. Only scalars. Secondly, CALCULATETABLE takes types of arguments that are filters or boolean expressions. Your code does not adhere to the syntax. Last thing... model tables cannot be dynamic. They're always static, so no matter what you do, you cannot change such a table depending on any measure. Such tables are recalculated only once: when you refresh your data. Then they're set in stone till the next refresh.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For syntax please consult &lt;A href="https://dax.guide/calculatetable" target="_blank" rel="noopener"&gt;https://dax.guide/calculatetable&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 17:31:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2530069#M70928</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-05-20T17:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: If/Then logic to create a table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2530085#M70933</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp; What I am trying to do is identify the type of user logged in when using RLS and then have the table populated for one type of user (non-CSS) and empty for the other (CSS).&amp;nbsp; The booloean is used only to identify which it is when the user is logged in, and then would create the table with data or empty.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 17:45:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2530085#M70933</guid>
      <dc:creator>jflipse</dc:creator>
      <dc:date>2022-05-20T17:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: If/Then logic to create a table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2530087#M70934</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;I beleive the Boolean filters used in Calculate and CALCULATABLE are more of a column variety and not measues.&lt;/P&gt;&lt;P&gt;E,G. Stock{Item Price] &amp;gt; 10. Both these functions turn the Boolean results into tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the Stock Item Example&amp;nbsp;&lt;/P&gt;&lt;P&gt;High Priced Items = CALCULATETABLE(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Stock,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Stock[Unit Price] &amp;gt; 500&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To write your formula(measure) this may work:(would need to see the data)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILTER(&lt;BR /&gt;&amp;nbsp;&amp;nbsp; SUMMARIZE(‘Home Care’,&lt;BR /&gt;'Home Care'[PHY_NPI],&lt;/P&gt;&lt;P&gt;“IS CSS”, [IsCSS]),&lt;BR /&gt;[Is CSS] = “TRUE”)&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 17:46:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2530087#M70934</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-05-20T17:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: If/Then logic to create a table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2530089#M70935</link>
      <description>&lt;P&gt;NO. That's not possible.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 17:46:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2530089#M70935</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-05-20T17:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: If/Then logic to create a table in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2537806#M71383</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="10256" data-lia-user-login="jflipse" class="lia-mention lia-mention-user"&gt;jflipse&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot implement RLS using a calculated table. RLS is a restriction on the rows in the table, so could you please share your example data and expected output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Winniz&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 05:41:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-Then-logic-to-create-a-table-in-DAX/m-p/2537806#M71383</guid>
      <dc:creator>v-kkf-msft</dc:creator>
      <dc:date>2022-05-25T05:41:01Z</dc:date>
    </item>
  </channel>
</rss>

