<?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: Need help converting SQL Statement to DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649098#M141334</link>
    <description>&lt;P&gt;Thanks for the quick response.&amp;nbsp; I tried this, but seem to be having issues with my IF statements. For some reason it's only recognizing new measures and won't allow me to reference the other columns.&amp;nbsp; Would your fix be considered a new measure or column?&amp;nbsp; When I try the new column and measure I get the error message in the screenshot. Have you seen this before?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jan 2024 21:38:18 GMT</pubDate>
    <dc:creator>cheid_4838</dc:creator>
    <dc:date>2024-01-19T21:38:18Z</dc:date>
    <item>
      <title>Need help converting SQL Statement to DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649045#M141329</link>
      <description>&lt;P&gt;I need to convert a SQL statement using "CASE" to a DAX statement.&amp;nbsp; I want to have the results show "1" so I can calculate the total number of orders that have a glnumber beginning with 400 and an invoice number that doesn't begin with S (ignore the bold).&amp;nbsp; I would typically use an IF statement, but I can't do that in Power BI.&amp;nbsp; Any suggestions would be greatly appreciated.&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;, case when left(id.ivd_glnum,3) = '400' &lt;STRONG&gt;and ih.ivh_shipper like 'ALLBRI%'&lt;/STRONG&gt; and left(ih.ivh_invoicenumber,1) &amp;lt;&amp;gt; 'S' then 1 else 0 end as Vol&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 20:42:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649045#M141329</guid>
      <dc:creator>cheid_4838</dc:creator>
      <dc:date>2024-01-19T20:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SQL Statement to DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649083#M141331</link>
      <description>&lt;P&gt;It should be very similar.&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Vol =
IF (
    LEFT ( id[ivd_glnum], 3 ) = "400"
        &amp;amp;&amp;amp; LEFT ( ih[ivh_shipper], 6 ) = "ALLBRI"
        &amp;amp;&amp;amp; LEFT ( ih[ivh_invoicenumber], 1 ) &amp;lt;&amp;gt; "S",
    1,
    0
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check out this article for more SQL to DAX logic:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/" target="_blank"&gt;https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 21:15:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649083#M141331</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-01-19T21:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SQL Statement to DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649098#M141334</link>
      <description>&lt;P&gt;Thanks for the quick response.&amp;nbsp; I tried this, but seem to be having issues with my IF statements. For some reason it's only recognizing new measures and won't allow me to reference the other columns.&amp;nbsp; Would your fix be considered a new measure or column?&amp;nbsp; When I try the new column and measure I get the error message in the screenshot. Have you seen this before?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 21:38:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649098#M141334</guid>
      <dc:creator>cheid_4838</dc:creator>
      <dc:date>2024-01-19T21:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SQL Statement to DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649204#M141338</link>
      <description>&lt;P&gt;I wrote it to be used as a calculated column. It won't work for a measure as written (since columns are aggregated in measures).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like those aren't valid column names. What are the actual names of your table and columns when loaded into Power BI?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 23:23:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649204#M141338</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-01-19T23:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SQL Statement to DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649290#M141341</link>
      <description>&lt;P&gt;I was able to get it to work the way I wanted to (1st screenshot) with the below formula, however when I remove the GL Num column and sum the volume I get 2 instead of 1.&amp;nbsp; There are multiple gl numbers per invoice. I only want to sum the volume for gl numbers that are 400 which I thought I was getting with the results in the screenshot.&amp;nbsp; Am I doing something wrong that is not allowing the volume to sum to 1?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VOLUME =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;If&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;LEFT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;invoicedetail&lt;/SPAN&gt;&lt;SPAN&gt;[InvoiceNumber]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;lt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;"S"&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;invoicedetail&lt;/SPAN&gt;&lt;SPAN&gt;[GL NUM]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"400"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"1"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"0"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 20 Jan 2024 03:33:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3649290#M141341</guid>
      <dc:creator>cheid_4838</dc:creator>
      <dc:date>2024-01-20T03:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting SQL Statement to DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3650543#M141411</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="677608" data-lia-user-login="cheid_4838" class="lia-mention lia-mention-user"&gt;cheid_4838&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try calculated column like below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Vol = 
IF (
    LEFT('YourTable'[ivd_glnum], 3) = "400" &amp;amp;&amp;amp; 
    LEFT('YourTable'[ivh_invoicenumber], 1) &amp;lt;&amp;gt; "S",
    1,
    0
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 02:28:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-converting-SQL-Statement-to-DAX/m-p/3650543#M141411</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-22T02:28:27Z</dc:date>
    </item>
  </channel>
</rss>

