<?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: Create table filtered with several considerations in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3067652#M106284</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="477226" data-lia-user-login="Laocsulak" class="lia-mention lia-mention-user"&gt;Laocsulak&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have created a simple sample, please refer to my pbix file to see if it helps you.&lt;/P&gt;
&lt;P&gt;Create 2 measures.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_DUE = IF(MAX('Table 1'[status])="DUE",0,1)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Measure = var _thismonth=TODAY()
var _lastmonth=EDATE(TODAY(),-1)
var _minbuy=CALCULATE(MIN('Table 1'[created_date]),FILTER(ALL('Table 1'),'Table 1'[user]=SELECTEDVALUE('Table 1'[user])&amp;amp;&amp;amp;'Table 1'[installment]=MINX(ALLSELECTED('Table 1'),'Table 1'[installment])))

VAR _DUE=MINX(FILTER(ALLSELECTED('Table 1'),'Table 1'[user]=SELECTEDVALUE('Table 1'[user])),[_DUE])
VAR _NEWBUY=IF(_minbuy&amp;gt;=_lastmonth&amp;amp;&amp;amp;_minbuy&amp;lt;=_thismonth,BLANK(),1)
RETURN 
IF(_DUE=0,BLANK(),IF(_NEWBUY=0,BLANK(),1))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can create a new table.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table = FILTER(SUMMARIZE('Table 1','Table 1'[user],'Table 1'[order_id],'Table 1'[installment],"aa",[Measure]),[Measure]&amp;lt;&amp;gt;BLANK())&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2023 03:02:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-02-08T03:02:06Z</dc:date>
    <item>
      <title>Create table filtered with several considerations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3065291#M106111</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help creating a table where I have transactions paid in installments where the column status has the next characteristics:&lt;/P&gt;&lt;P&gt;Status = COMPLETED -&amp;gt; installment paid&lt;BR /&gt;Status = DUE -&amp;gt; installment overdue&lt;BR /&gt;Status = PENDING -&amp;gt; installment not paid, but not overdue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create a table of users with the following characteristics:&lt;BR /&gt;- Users that have the last installment completed in the current or previous month (in this example in Feb-23 or Jan-23)&lt;BR /&gt;- Users that don't have due installments&lt;BR /&gt;- Users that don't have a new purchase in the current or previous month, that's to say, they don't have a first installment in the current or previous month&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I provide the following dummy example to solve:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The column installment shows if it is the first installment (1), the second installment (2) or the third installment (3). There are purchases made in 2 and 3 installments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, the table only should contain users 1 and 2:&lt;BR /&gt;- User 1 was considered because he has the penultimate installment paid in January, doesn't have due installments, and doesn't have new purchases in January or February&lt;BR /&gt;- User 2 was considered because he has the last installment paid in January, doesn't have due installments, and doesn't have new purchases in January or February&lt;BR /&gt;- User 3 was not considered because he had an overdue installment&lt;BR /&gt;- User 4 was not considered because he had a new purchase in January&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Files:&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/drive/folders/10HO6y8kAdtun4gOUWEOPNOthsc-ktOaW?usp=share_link" target="_blank"&gt;https://drive.google.com/drive/folders/10HO6y8kAdtun4gOUWEOPNOthsc-ktOaW?usp=share_link&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 04:20:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3065291#M106111</guid>
      <dc:creator>Laocsulak</dc:creator>
      <dc:date>2023-02-07T04:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create table filtered with several considerations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3065468#M106123</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="477226" data-lia-user-login="Laocsulak" class="lia-mention lia-mention-user"&gt;Laocsulak&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;User 4 has only one order id?! Please clarify this point further.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 06:40:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3065468#M106123</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-02-07T06:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create table filtered with several considerations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3066144#M106171</link>
      <description>&lt;P&gt;Every user could have many order_id. In this example, users 4, 2, and 1 have only one order_id, and user 3 has two order_id.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 16:36:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3066144#M106171</guid>
      <dc:creator>Laocsulak</dc:creator>
      <dc:date>2023-02-07T16:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Create table filtered with several considerations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3067652#M106284</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="477226" data-lia-user-login="Laocsulak" class="lia-mention lia-mention-user"&gt;Laocsulak&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have created a simple sample, please refer to my pbix file to see if it helps you.&lt;/P&gt;
&lt;P&gt;Create 2 measures.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_DUE = IF(MAX('Table 1'[status])="DUE",0,1)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Measure = var _thismonth=TODAY()
var _lastmonth=EDATE(TODAY(),-1)
var _minbuy=CALCULATE(MIN('Table 1'[created_date]),FILTER(ALL('Table 1'),'Table 1'[user]=SELECTEDVALUE('Table 1'[user])&amp;amp;&amp;amp;'Table 1'[installment]=MINX(ALLSELECTED('Table 1'),'Table 1'[installment])))

VAR _DUE=MINX(FILTER(ALLSELECTED('Table 1'),'Table 1'[user]=SELECTEDVALUE('Table 1'[user])),[_DUE])
VAR _NEWBUY=IF(_minbuy&amp;gt;=_lastmonth&amp;amp;&amp;amp;_minbuy&amp;lt;=_thismonth,BLANK(),1)
RETURN 
IF(_DUE=0,BLANK(),IF(_NEWBUY=0,BLANK(),1))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can create a new table.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table = FILTER(SUMMARIZE('Table 1','Table 1'[user],'Table 1'[order_id],'Table 1'[installment],"aa",[Measure]),[Measure]&amp;lt;&amp;gt;BLANK())&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 03:02:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3067652#M106284</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-08T03:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create table filtered with several considerations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3068140#M106319</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="477226" data-lia-user-login="Laocsulak" class="lia-mention lia-mention-user"&gt;Laocsulak&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please check if this is what you;re looking for.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;FilterMeasure = 
VAR CurrentTable = 
    transactions
VAR Condition1 = 
    NOT ISEMPTY ( 
        FILTER ( CurrentTable, transactions[status] = "COMPLETED" )
    )
VAR Condition2 = 
    ISEMPTY ( 
        FILTER ( CurrentTable, transactions[status] = "DUE" )
    )
VAR NumOfOrders = 
    COUNTROWS ( 
        DISTINCT (
            SELECTCOLUMNS ( CurrentTable, "@Order", transactions[order_id] )
        )
    )
VAR Condition3 = 
    NumOfOrders &amp;lt; 2
RETURN
    INT ( Condition1 &amp;amp;&amp;amp; Condition2 &amp;amp;&amp;amp; Condition3 )&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 08 Feb 2023 07:36:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-table-filtered-with-several-considerations/m-p/3068140#M106319</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-02-08T07:36:03Z</dc:date>
    </item>
  </channel>
</rss>

