<?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: Find position with next smalles date compared to a user-entered date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614504#M176589</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="340710" data-lia-user-login="sim_kay7" class="lia-mention lia-mention-user"&gt;sim_kay7&lt;/a&gt;&amp;nbsp;, Try using&lt;/P&gt;
&lt;P&gt;dax&lt;BR /&gt;CountOrdersByPosition =&lt;BR /&gt;VAR UserEnteredDate = [Selected_date]&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'Tabelle'[Order] ),&lt;BR /&gt;VAR MaxPos = CALCULATE (&lt;BR /&gt;MAX ( 'Tabelle'[Position] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;'Tabelle',&lt;BR /&gt;'Tabelle'[Date] = CALCULATE (&lt;BR /&gt;MAX ( 'Tabelle'[Date] ),&lt;BR /&gt;ALLEXCEPT ( 'Tabelle', 'Tabelle'[Order] ),&lt;BR /&gt;'Tabelle'[Date] &amp;lt; UserEnteredDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF (&lt;BR /&gt;MaxPos = [MaxPositionBeforeDate],&lt;BR /&gt;1,&lt;BR /&gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
    <pubDate>Tue, 18 Mar 2025 10:49:05 GMT</pubDate>
    <dc:creator>bhanu_gautam</dc:creator>
    <dc:date>2025-03-18T10:49:05Z</dc:date>
    <item>
      <title>Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614395#M176580</link>
      <description>&lt;P&gt;Hello, I have a table with Orders and various Positions within each Order, which have a date allocated. I wanted to create a Measure that finds the maximum position within each order that is smaller than a user-entered date. So for a user-entered date of 05.02.2025 the measure shall only return the rows marked in grey in the sample table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following measure does exactly that:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
VAR UserEnteredDate = [Selected_date] 
RETURN
CALCULATE (
    MAX ( 'Tabelle'[Position] ),  
    FILTER ('Tabelle', 
            'Tabelle'[Date] = CALCULATE (          
                                 MAX ( 'Tabelle'[Date] ),
                                 ALLEXCEPT ( 'Tabelle', 'Tabelle'[Order] ),                                                        
                                 'Tabelle'[Date] &amp;lt; UserEnteredDate                  
        )
    )
) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As a next step I would like to count the number of orders within each Position in the context of the Measure above. So desired result is to get 2 orders in Position '2' and 1 order in Position '1'.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried many different options but can't seem to get the proper result, so I really hope you can help with this.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 09:45:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614395#M176580</guid>
      <dc:creator>sim_kay7</dc:creator>
      <dc:date>2025-03-18T09:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614406#M176582</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="340710" data-lia-user-login="sim_kay7" class="lia-mention lia-mention-user"&gt;sim_kay7&lt;/a&gt;&amp;nbsp;Measure to find the maximum position within each order that is smaller than the user-entered date:&lt;/P&gt;
&lt;P&gt;DAX&lt;BR /&gt;MaxPositionBeforeDate = &lt;BR /&gt;VAR UserEnteredDate = [Selected_date]&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;MAX ( 'Tabelle'[Position] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;'Tabelle',&lt;BR /&gt;'Tabelle'[Date] = CALCULATE (&lt;BR /&gt;MAX ( 'Tabelle'[Date] ),&lt;BR /&gt;ALLEXCEPT ( 'Tabelle', 'Tabelle'[Order] ),&lt;BR /&gt;'Tabelle'[Date] &amp;lt; UserEnteredDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measure to count the number of orders for each position:&lt;/P&gt;
&lt;P&gt;DAX&lt;BR /&gt;CountOrdersByPosition = &lt;BR /&gt;VAR UserEnteredDate = [Selected_date]&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'Tabelle'[Order] ),&lt;BR /&gt;CALCULATE (&lt;BR /&gt;COUNTROWS ( 'Tabelle' ),&lt;BR /&gt;FILTER (&lt;BR /&gt;'Tabelle',&lt;BR /&gt;'Tabelle'[Position] = [MaxPositionBeforeDate] &amp;amp;&amp;amp;&lt;BR /&gt;'Tabelle'[Date] &amp;lt; UserEnteredDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 09:51:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614406#M176582</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-03-18T09:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614494#M176588</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;Thanks for your quick response! The first measure works fine, however the second measure "CountOrdersByPosition" doesn't deliver the expected result:&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;Any ideas how to modify the measure to make it work?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 10:45:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614494#M176588</guid>
      <dc:creator>sim_kay7</dc:creator>
      <dc:date>2025-03-18T10:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614504#M176589</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="340710" data-lia-user-login="sim_kay7" class="lia-mention lia-mention-user"&gt;sim_kay7&lt;/a&gt;&amp;nbsp;, Try using&lt;/P&gt;
&lt;P&gt;dax&lt;BR /&gt;CountOrdersByPosition =&lt;BR /&gt;VAR UserEnteredDate = [Selected_date]&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'Tabelle'[Order] ),&lt;BR /&gt;VAR MaxPos = CALCULATE (&lt;BR /&gt;MAX ( 'Tabelle'[Position] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;'Tabelle',&lt;BR /&gt;'Tabelle'[Date] = CALCULATE (&lt;BR /&gt;MAX ( 'Tabelle'[Date] ),&lt;BR /&gt;ALLEXCEPT ( 'Tabelle', 'Tabelle'[Order] ),&lt;BR /&gt;'Tabelle'[Date] &amp;lt; UserEnteredDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF (&lt;BR /&gt;MaxPos = [MaxPositionBeforeDate],&lt;BR /&gt;1,&lt;BR /&gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 10:49:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614504#M176589</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-03-18T10:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614711#M176602</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;I thought this would solve it. It does work properly for a user-entered date of 05.02.2025. Unfortunately for another date it returns a wrong result (e.g. 31.01.2025: expected result would be a count of 2 for Position '1' but it returns a count of 2 for each):&amp;nbsp;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 12:52:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614711#M176602</guid>
      <dc:creator>sim_kay7</dc:creator>
      <dc:date>2025-03-18T12:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614747#M176604</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="340710" data-lia-user-login="sim_kay7" class="lia-mention lia-mention-user"&gt;sim_kay7&lt;/a&gt;&amp;nbsp;, Try this one&lt;/P&gt;
&lt;P&gt;dax&lt;BR /&gt;CountOrdersByPosition =&lt;BR /&gt;VAR UserEnteredDate = [Selected_date]&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'Tabelle'[Order] ),&lt;BR /&gt;VAR MaxPos = CALCULATE (&lt;BR /&gt;MAX ( 'Tabelle'[Position] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;'Tabelle',&lt;BR /&gt;'Tabelle'[Date] = CALCULATE (&lt;BR /&gt;MAX ( 'Tabelle'[Date] ),&lt;BR /&gt;ALLEXCEPT ( 'Tabelle', 'Tabelle'[Order] ),&lt;BR /&gt;'Tabelle'[Date] &amp;lt; UserEnteredDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF (&lt;BR /&gt;MaxPos = CALCULATE (&lt;BR /&gt;MAX ( 'Tabelle'[Position] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;'Tabelle',&lt;BR /&gt;'Tabelle'[Date] &amp;lt; UserEnteredDate&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;1,&lt;BR /&gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 13:07:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614747#M176604</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-03-18T13:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614922#M176611</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;: The lastest measure seems to not respond to the user-entered date. Is it possible to attach the .pbix-file here, maybe that helps?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 15:12:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4614922#M176611</guid>
      <dc:creator>sim_kay7</dc:creator>
      <dc:date>2025-03-18T15:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4692345#M179680</link>
      <description>&lt;P&gt;Thankyou,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;, for your response.&lt;BR /&gt;&lt;BR /&gt;Hi sim_kay7,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We appreciate your inquiry posted on the Microsoft Fabric Community Forum.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Please find attached the screenshot and the PBIX file that may assist in resolving the issue:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you find our response helpful, kindly mark it as the accepted solution and provide kudos. This will aid other community members facing similar queries.&lt;/P&gt;
&lt;P&gt;Should you have any further questions, please feel free to contact the Microsoft Fabric Community.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 10:59:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4692345#M179680</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2025-05-14T10:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4696934#M179889</link>
      <description>&lt;P&gt;Hi sim_kay7,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We have not received a response from you regarding the query and were following up to check if you have found a resolution. If you have identified a solution, we kindly request you to share it with the community, as it may be helpful to others facing a similar issue.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you find the response helpful, please mark it as the accepted solution and provide kudos, as this will help other members with similar queries.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 May 2025 18:12:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4696934#M179889</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2025-05-17T18:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4699804#M180029</link>
      <description>&lt;P&gt;Hi sim_kay7,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We wanted to check in regarding your query, as we have not heard back from you. If you have resolved the issue, sharing the solution with the community would be greatly appreciated and could help others encountering similar challenges.&lt;/P&gt;
&lt;P&gt;If you found our response useful, kindly mark it as the accepted solution and provide kudos to guide other members.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 09:45:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4699804#M180029</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2025-05-20T09:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4705666#M180229</link>
      <description>&lt;P&gt;Hi sim_kay7,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P data-pm-slice="1 1 []"&gt;We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.&lt;/P&gt;
&lt;P&gt;If our response was helpful, please mark it as the accepted solution and provide kudos, as this helps the broader community.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 24 May 2025 02:03:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4705666#M180229</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2025-05-24T02:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Find position with next smalles date compared to a user-entered date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4754234#M182038</link>
      <description>&lt;P&gt;Hi sim_kay7,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We are following up to check if your query has been resolved. If you have found a solution, kindly share it with the community to help others facing similar issues.&lt;/P&gt;
&lt;P&gt;If our response was helpful, please mark it as the accepted solution. This will benefit the wider community.&lt;/P&gt;
&lt;P&gt;Should you have any further queries, kindly feel free to contact the Microsoft Fabric community.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jul 2025 17:18:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-position-with-next-smalles-date-compared-to-a-user-entered/m-p/4754234#M182038</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2025-07-06T17:18:47Z</dc:date>
    </item>
  </channel>
</rss>

