<?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 to get distinct value over overlaping period while filtering on one year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-distinct-value-over-overlaping-period-while-filtering/m-p/4072542#M161680</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="783832" data-lia-user-login="KXuan" class="lia-mention lia-mention-user"&gt;KXuan&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you want to filter the table when year is selected in slicer? For example, when user selects 2019, the first row will be filtered.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please modify your original Dax expression as following.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure  =
  var minyear= MIN('(F) Contract' [Beigin])
  var maxyear= MAX('(F) Contract' [End])
  RETURN
  IF(SELECTEDVALUE(Table2[Year]) &amp;lt;&amp;gt; BLANK() , IF(SELECTEDVALUE(Table2[Year]) &amp;gt; YEAR(minyear) &amp;amp;&amp;amp; SELECTEDVALUE(Table2[Year]) &amp;lt;= YEAR(maxyear) , 1 , 0) , 3)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then set Filter as following.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my test for your reference.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Mengmeng Li&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Aug 2024 03:18:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-08-01T03:18:20Z</dc:date>
    <item>
      <title>How to get distinct value over overlaping period while filtering on one year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-distinct-value-over-overlaping-period-while-filtering/m-p/4072144#M161666</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I need you help, I've been trying to solve this problem for several days and still don't know what to do.&lt;/P&gt;&lt;P&gt;I have a contract with 2 rows in my fact table, the first line is when the contract beginns and the second line is the extension. Both have the same price of 17,99Euro. According to bussiness definition , if I filter on 2019, I need to get the price 17,99 once in total, because the price should be considered only once in one year (2019).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;And if I do not filter, then I should get the sume of those, since I'm querying the entire period. In this case, my measure works.&amp;nbsp; Has anyone faced this problem, or has idea how to solve this with dax ?&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;&lt;P&gt;Here is my measure :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;minDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;[minSelectedDate (Date)]&lt;/SPAN&gt;&lt;/DIV&gt;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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Xuan&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 20:50:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-distinct-value-over-overlaping-period-while-filtering/m-p/4072144#M161666</guid>
      <dc:creator>KXuan</dc:creator>
      <dc:date>2024-07-31T20:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get distinct value over overlaping period while filtering on one year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-distinct-value-over-overlaping-period-while-filtering/m-p/4072542#M161680</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="783832" data-lia-user-login="KXuan" class="lia-mention lia-mention-user"&gt;KXuan&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you want to filter the table when year is selected in slicer? For example, when user selects 2019, the first row will be filtered.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please modify your original Dax expression as following.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure  =
  var minyear= MIN('(F) Contract' [Beigin])
  var maxyear= MAX('(F) Contract' [End])
  RETURN
  IF(SELECTEDVALUE(Table2[Year]) &amp;lt;&amp;gt; BLANK() , IF(SELECTEDVALUE(Table2[Year]) &amp;gt; YEAR(minyear) &amp;amp;&amp;amp; SELECTEDVALUE(Table2[Year]) &amp;lt;= YEAR(maxyear) , 1 , 0) , 3)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then set Filter as following.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my test for your reference.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Mengmeng Li&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 03:18:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-distinct-value-over-overlaping-period-while-filtering/m-p/4072542#M161680</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-01T03:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to get distinct value over overlaping period while filtering on one year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-distinct-value-over-overlaping-period-while-filtering/m-p/4073014#M161703</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN&gt;Mengmeng&amp;nbsp;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Unfortunately, it's not what I want :(. Actually ,I just want to have the correct total without filtering in the table as in you example.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The idea of this measure is to get the price of contract which is valid in selected period ( so I think _maxyear und _minyear should be based on seperate date dimension instead ).&amp;nbsp; In this example, it's 17,99 for 2019 or 2020 and 35,98 for the entire period.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope, that I explaned it well &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Xuan&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 07:36:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-distinct-value-over-overlaping-period-while-filtering/m-p/4073014#M161703</guid>
      <dc:creator>KXuan</dc:creator>
      <dc:date>2024-08-01T07:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to get distinct value over overlaping period while filtering on one year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-distinct-value-over-overlaping-period-while-filtering/m-p/4100479#M162717</link>
      <description>&lt;P&gt;I solved that problem by using summarize:)&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 14:41:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-distinct-value-over-overlaping-period-while-filtering/m-p/4100479#M162717</guid>
      <dc:creator>KXuan</dc:creator>
      <dc:date>2024-08-14T14:41:47Z</dc:date>
    </item>
  </channel>
</rss>

