<?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: DAX syntax for SQL query in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-syntax-for-SQL-query/m-p/2529817#M70911</link>
    <description>&lt;P&gt;It's not that easy or simple to translate a SQL query into DAX. One has to know the structure of the model first.&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2022 15:13:06 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-05-20T15:13:06Z</dc:date>
    <item>
      <title>DAX syntax for SQL query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-syntax-for-SQL-query/m-p/2529034#M70841</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a SQL query for my database which I use for grouping entries in a survey table by specific departments.&lt;/P&gt;&lt;P&gt;As a result I want a simple table that looks somewhat like my SQL query.&lt;/P&gt;&lt;P&gt;SQL query&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;select md.DEPARTMENT,
count(distinct mpqr.MEDIC_UID)
from `20583`.MEDIC_PROPERTY_QUESTION_RESULT mpqr 
left join `20583`.MEDIC m 
on mpqr.MEDIC_UID  = m.UID
left join `20583`.MEDIC_DEPARTMENT md 
on m.DEPARTMENT_UID = md.UID
group by md.DEPARTMENT
order by 2 desc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I accomplish to get a table in Power BI?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the end I only want to use a simple measure that gives me the [DEPARTMENT] for MAX([count(distinct mpqr.MEDIC_UID]) which means '525' in this specific case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 10:00:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-syntax-for-SQL-query/m-p/2529034#M70841</guid>
      <dc:creator>deboec</dc:creator>
      <dc:date>2022-05-20T10:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: DAX syntax for SQL query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-syntax-for-SQL-query/m-p/2529817#M70911</link>
      <description>&lt;P&gt;It's not that easy or simple to translate a SQL query into DAX. One has to know the structure of the model first.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 15:13:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-syntax-for-SQL-query/m-p/2529817#M70911</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-05-20T15:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: DAX syntax for SQL query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-syntax-for-SQL-query/m-p/2530614#M70972</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;These answers depend on how your model is set up. I will paste a link to a file that shows the model set up and then thetwo measures for DISTINCTCOUNT.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will link a file example for MAX Distinct Count. I have used my table names and you would substitute in your "Department" table name where I have Channel. and where I used Data[Order ID] that's where you put your table[column name] which I think is&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;mpqr.[MEDIC_UID] but I can't tell. I hope this helps. It looks a little overwhelming but is not too hard if you go step by step. You'll notice the first DISTINCTCOUNT measure is referenced in the final measure (solution measure), MAX DISTINCT COUNT.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A title="MAX Distinct Count" href="https://drive.google.com/file/d/10mpcXrtjdtE7BGiqhArgUafjTk7StYUQ/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/10mpcXrtjdtE7BGiqhArgUafjTk7StYUQ/view?usp=sharing&lt;/A&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>Sat, 21 May 2022 13:03:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-syntax-for-SQL-query/m-p/2530614#M70972</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-05-21T13:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: DAX syntax for SQL query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-syntax-for-SQL-query/m-p/2532542#M71072</link>
      <description>&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;The measure helped me with my end goal:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max Distinct CT =
CALCULATE(
     VALUES(
          Channel[Channel],
     ),
     TOPN(
          1,
          Channel[Channel],
          [DISTINCT COUNT Order ID],
          DESC
     )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case it was:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max Distinct Values =
CALCULATE(
     VALUES(
          MEDIC_DEPARTMENT[DEPARTMENT],
     ),
     TOPN(
          1,
          MEDIC_DEPARTMENT[DEPARTMENT],
          [DISTINCT COUNT MEDIC_UID],
          DESC
     )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 23 May 2022 08:24:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-syntax-for-SQL-query/m-p/2532542#M71072</guid>
      <dc:creator>deboec</dc:creator>
      <dc:date>2022-05-23T08:24:33Z</dc:date>
    </item>
  </channel>
</rss>

