<?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: How do I translate this sql query into DAX and get the visual I want to have? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240803#M53643</link>
    <description>&lt;P&gt;Thank you very much. I will try it later. I actually don't need Key_ProductDetails from order table. This is the foreign key that is connected with primary key in the Table called 'product'.&amp;nbsp; And that's where Axis field come from. I am using product name hierarchy from 'Product' table. So in this way,&amp;nbsp; do I need to change your formula? like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = calculate(max(tbl[PaymentDatetIme]),allexcept(tbl,tbl[Key_Profiles],'product'[Key_ProductDetails]))&lt;/LI-CODE&gt;&lt;P&gt;?&lt;/P&gt;</description>
    <pubDate>Wed, 15 Dec 2021 18:11:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-12-15T18:11:37Z</dc:date>
    <item>
      <title>How do I translate this sql query into DAX and get the visual I want to have?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240310#M53601</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to make such a visual. % of customers in different Product.&amp;nbsp; I have product hierarchy and customer IDs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;However, Customer IDs is from our order table. Which means it is not necessary the lastest purchase that the customer made. I want to have the lastest product they purchased and see how that distributed in different groups.&lt;BR /&gt;I have a sql query like this:&lt;/P&gt;&lt;P&gt;select max(PaymentDateTime),Key_Profiles, Key_ProductDetails&lt;BR /&gt;from [edw].[FactOrders]&lt;BR /&gt;group by Key_Profiles,Key_ProductDetails&lt;BR /&gt;order by key_profiles&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I create a measure that filter only the lastest purchase?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for helping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Lin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 13:11:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240310#M53601</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-15T13:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I translate this sql query into DAX and get the visual I want to have?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240346#M53611</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , Max on the column&amp;nbsp; PaymentDateTime in a visual should do &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;measure examples&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;max(FactOrders[PaymentDateTime])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;maxx(summarize(FactOrders, [Key_Profiles], [Key_ProductDetails], "_1", max(FactOrders[PaymentDateTime])&amp;nbsp; ) , [_1] )&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 13:38:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240346#M53611</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-15T13:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I translate this sql query into DAX and get the visual I want to have?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240415#M53615</link>
      <description>&lt;P&gt;This is what I wrote:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Customer_Latest_Purchase = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;count&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'edw FactOrders'[Key_Profiles]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'edw FactOrders'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'edw FactOrders'[PaymentDateTime]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;max&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'edw FactOrders'[PaymentDateTime]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;But the number is not correct&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;img /&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Dec 2021 14:21:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240415#M53615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-15T14:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I translate this sql query into DAX and get the visual I want to have?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240541#M53616</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp; the equivalent measure is&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = calculate(max(tbl[PaymentDatetIme]),allexcept(tbl,tbl[Key_Profiles],tbl[Key_ProductDetails]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;once you have that, put&amp;nbsp;&lt;SPAN&gt;Key_Profiles, Key_ProductDetails on X axis and use the measure on Y axis&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 15:21:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240541#M53616</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-12-15T15:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I translate this sql query into DAX and get the visual I want to have?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240803#M53643</link>
      <description>&lt;P&gt;Thank you very much. I will try it later. I actually don't need Key_ProductDetails from order table. This is the foreign key that is connected with primary key in the Table called 'product'.&amp;nbsp; And that's where Axis field come from. I am using product name hierarchy from 'Product' table. So in this way,&amp;nbsp; do I need to change your formula? like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = calculate(max(tbl[PaymentDatetIme]),allexcept(tbl,tbl[Key_Profiles],'product'[Key_ProductDetails]))&lt;/LI-CODE&gt;&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 18:11:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240803#M53643</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-15T18:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I translate this sql query into DAX and get the visual I want to have?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240806#M53644</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp; I am having trouble visualizing the req. Is it kindly possible to cretae a pbix in a samll scale and post here or provide a SQL DDL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was simply translating the query.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 18:14:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-do-I-translate-this-sql-query-into-DAX-and-get-the-visual-I/m-p/2240806#M53644</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-12-15T18:14:30Z</dc:date>
    </item>
  </channel>
</rss>

