<?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 DAX based on the min and max of the selected values in Slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672488#M142471</link>
    <description>&lt;P&gt;I have a calculated column and I want it to be based on the minimum and maximum value selected from the slicer. In fact this formula should work also with the min and max of the slicer instead of the fixed dates. I also attached the sample of the .pbix data &lt;A href="https://drive.google.com/file/d/1-SEWClKYS1fkVlDNSJVTzH1tIba34aoo/view?usp=sharing" target="_self"&gt;HERE&lt;BR /&gt;&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;quantity_sum_correct = 
VAR SelectedStartDate = DATE(2023,2,1)
VAR SelectedEndDate = DATE(2023,3,1)
RETURN
SUMX(
    FILTER(
        RELATEDTABLE(Quantity),
        Quantity[Date] &amp;gt;= SelectedStartDate &amp;amp;&amp;amp;
        Quantity[Date] &amp;lt;= SelectedEndDate),
    Quantity[quantity]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Feb 2024 08:56:19 GMT</pubDate>
    <dc:creator>farzadvhd</dc:creator>
    <dc:date>2024-02-01T08:56:19Z</dc:date>
    <item>
      <title>DAX based on the min and max of the selected values in Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672488#M142471</link>
      <description>&lt;P&gt;I have a calculated column and I want it to be based on the minimum and maximum value selected from the slicer. In fact this formula should work also with the min and max of the slicer instead of the fixed dates. I also attached the sample of the .pbix data &lt;A href="https://drive.google.com/file/d/1-SEWClKYS1fkVlDNSJVTzH1tIba34aoo/view?usp=sharing" target="_self"&gt;HERE&lt;BR /&gt;&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;quantity_sum_correct = 
VAR SelectedStartDate = DATE(2023,2,1)
VAR SelectedEndDate = DATE(2023,3,1)
RETURN
SUMX(
    FILTER(
        RELATEDTABLE(Quantity),
        Quantity[Date] &amp;gt;= SelectedStartDate &amp;amp;&amp;amp;
        Quantity[Date] &amp;lt;= SelectedEndDate),
    Quantity[quantity]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 08:56:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672488#M142471</guid>
      <dc:creator>farzadvhd</dc:creator>
      <dc:date>2024-02-01T08:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: DAX based on the min and max of the selected values in Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672509#M142474</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="681634" data-lia-user-login="farzadvhd" class="lia-mention lia-mention-user"&gt;farzadvhd&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Calculated columns cannot access slicer value. Is there any specific reason you are using Calculated columns instead of measures? Can the same logic be replicated as a measure (which is more efficient in terms of performance)?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 09:04:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672509#M142474</guid>
      <dc:creator>govindarajan_d</dc:creator>
      <dc:date>2024-02-01T09:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: DAX based on the min and max of the selected values in Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672518#M142475</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="644992" data-lia-user-login="govindarajan_d" class="lia-mention lia-mention-user"&gt;govindarajan_d&lt;/a&gt;&amp;nbsp;when I am using measure the total would not be correct, however the values in each row (considering a table in report view) are correct. I appreciate it if you could take a look at the sample I attached to see if there is any other way&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 09:31:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672518#M142475</guid>
      <dc:creator>farzadvhd</dc:creator>
      <dc:date>2024-02-01T09:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: DAX based on the min and max of the selected values in Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672768#M142491</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="681634" data-lia-user-login="farzadvhd" class="lia-mention lia-mention-user"&gt;farzadvhd&lt;/a&gt;&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;I see that there is many-to-many relationship between quantity and metal. And this causes duplicates in the table because there is no date column in the metals table. The row duplicates itself for each date that is present in the quantity table. Is this what you want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;During totals, Power BI calculates the sum by having no row level filter on the formula. That is why you are getting 1190.&lt;BR /&gt;&lt;BR /&gt;But I cannot understand how you want the sum to be. Please provide more details.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 10:59:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672768#M142491</guid>
      <dc:creator>govindarajan_d</dc:creator>
      <dc:date>2024-02-01T10:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: DAX based on the min and max of the selected values in Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672799#M142493</link>
      <description>&lt;P&gt;In fact the Metal table does not have any date because it contains different Metals for each Article. So they are in multiple rows and I want the sum to consider these duplicates,&amp;nbsp; Above all I need pz*gr&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I already solved the issue in &lt;A href="https://drive.google.com/file/d/1NQ3UJ8ZnlPuTaVpksk4GHT4gaymhPduO/view?usp=sharing" target="_self"&gt;Excel &lt;/A&gt;&lt;BR /&gt;By creating a pivot table and xlookup of pivoted table, but I don't know how to apply it in power BI.&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your help&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 11:19:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3672799#M142493</guid>
      <dc:creator>farzadvhd</dc:creator>
      <dc:date>2024-02-01T11:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: DAX based on the min and max of the selected values in Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3674983#M142640</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="681634" data-lia-user-login="farzadvhd" class="lia-mention lia-mention-user"&gt;farzadvhd&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I’ve read through the thread and I see that&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="644992" data-lia-user-login="govindarajan_d" class="lia-mention lia-mention-user"&gt;govindarajan_d&lt;/a&gt;&amp;nbsp;has already provided some insightful responses.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Since you created a calculated column, and it&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;nbsp;will not&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;change according to the user interaction(slicer, filter, column selections etc.) in the report&amp;nbsp;as&amp;nbsp;the value of a calculated column is computed during data refresh and uses the current row as a context... Please review the following links about the difference of calculated column and measure...&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A title="https://nam06.safelinks.protection.outlook.com/?url=https%3a%2f%2fwww.sqlbi.com%2farticles%2fcalculated-columns-and-measures-in-dax%2f&amp;amp;data=04%7c01%7cv-yiruan%40microsoft.com%7c6c82a3be2f13483c8c8408d9625c1586%7c72f988bf86f141af91ab2d7cd011db47%7c1%7c0%7c" href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.sqlbi.com%2Farticles%2Fcalculated-columns-and-measures-in-dax%2F&amp;amp;data=05%7C01%7Cv-yiruan%40microsoft.com%7C6de73d65f8704276e06808daf5452fa0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638091974775574520%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=2aRbnxQgWK%2FXMku4Xzmg6t5v86pAHmgIULunq1emSY4%3D&amp;amp;reserved=0" target="_blank" rel="noopener nofollow noreferrer"&gt;Calculated Columns and Measures in DAX&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A title="https://nam06.safelinks.protection.outlook.com/?url=https%3a%2f%2finsightsoftware.com%2fblog%2fcalculated-columns-vs-measures%2f&amp;amp;data=04%7c01%7cv-yiruan%40microsoft.com%7c6c82a3be2f13483c8c8408d9625c1586%7c72f988bf86f141af91ab2d7cd011db47%7c1%7c0%7c637648" href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Finsightsoftware.com%2Fblog%2Fcalculated-columns-vs-measures%2F&amp;amp;data=05%7C01%7Cv-yiruan%40microsoft.com%7C6de73d65f8704276e06808daf5452fa0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638091974775574520%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=ZlaXI8Ln68OlZMyCc7owferpyyaQ1CKUhCkWL9i4WSs%3D&amp;amp;reserved=0" target="_blank" rel="noopener nofollow noreferrer" aria-label="Link Calculated Columns vs Measures"&gt;Calculated Columns vs Measures&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So if you want to get the dynamic value base on the selected values, you need to create a&amp;nbsp;&lt;STRONG&gt;measure&lt;/STRONG&gt;&amp;nbsp;as below to&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;replace&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;the original calculated column.&amp;nbsp;Please find the details in&lt;EM&gt;&lt;STRONG&gt; the attachment&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR SelectedStartDate =
    MIN ( Quantity[Date] )
VAR SelectedEndDate =
    MAX ( Quantity[Date] )
RETURN
    SUMX (
        FILTER (
            Quantity,
            Quantity[Date] &amp;gt;= SelectedStartDate
                &amp;amp;&amp;amp; Quantity[Date] &amp;lt;= SelectedEndDate
        ),
        Quantity[quantity]
    )
        * SUM ( Metals[Gram] )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;pz*gr = SUMX ( GROUPBY ( 'Metals', 'Metals'[key], 'Metals'[Metal] ), [Measure] )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 08:07:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-based-on-the-min-and-max-of-the-selected-values-in-Slicer/m-p/3674983#M142640</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-02T08:07:17Z</dc:date>
    </item>
  </channel>
</rss>

