<?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: DAX formula to get max value among selected items in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1202826#M19280</link>
    <description>&lt;P&gt;I understand your point. The thing here is that Active employees refer to the number of active employees at a particular point in time and cannot be cummulative. That Date slicer controls other metrics on the Report and these metrics need cummulative figures (where the user is selecting more than 1 month on the Date slicer).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jul 2020 06:47:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-07-06T06:47:08Z</dc:date>
    <item>
      <title>DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1200930#M19188</link>
      <description>&lt;DIV class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;I have a measure in my Power BI report which stands as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Active Employees = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OnlyActiveEmployees = FILTER(Employee,Employee[Description] = "Active")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ActEmp = IF(ISBLANK(CALCULATE(SUM(Employee[EmpValue]),OnlyActiveEmployees)),0,CALCULATE(SUM(Employee[EmpValue]),OnlyActiveEmployees))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF (ISFILTERED(Date_List[MmmYYYY]) &amp;amp;&amp;amp; calculate(count(Date_List[MmmYYYY])) &amp;gt; 1, "NA", ActEmp)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;To simplify, this measure will give a value of "NA" if the user selects more than 1 month in the provided Date Slicer. I want to modify this measure so that its output is based on the maximum date being selected (when 2 or more dates are selected on the Date Slicer).&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;How can I do that?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Jul 2020 19:26:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1200930#M19188</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-03T19:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201064#M19192</link>
      <description>&lt;P&gt;Your first variable does not break out of the filter context. It will always only return one row. Use ALL or ALLSELECTED.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2020 21:30:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201064#M19192</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-07-03T21:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201294#M19209</link>
      <description>&lt;P&gt;As suggested by&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp; use a function that ignores filter context and I think you could improve your formula a bit and modify it to this, but this is my assumption that it might work for you.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Active Employees =
VAR OnlyActiveEmployees =
    FILTER (
        ALLSELECTED ( Employee[Description] ),
        Employee[Description] = "Active"
    )
VAR ActiveTotal =
    CALCULATE ( SUM ( Employee[EmpValue] ), OnlyActiveEmployees )
RETURN
    IF ( DISTINCTCOUNT ( Date_List[MmmYYYY] ) &amp;gt; 1, "NA", ActiveTotal + 0 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jul 2020 09:53:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201294#M19209</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2020-07-04T09:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201401#M19213</link>
      <description>&lt;P&gt;I still get an "NA" as per your solution when the user selects more than 1 month.&lt;BR /&gt;I guess the issue is with this part of your formula:&lt;/P&gt;&lt;PRE&gt;IF ( DISTINCTCOUNT ( Date_List[MmmYYYY] ) &amp;gt; 1, "NA", ActiveTotal + 0 )&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Jul 2020 15:58:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201401#M19213</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-04T15:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201404#M19216</link>
      <description>Because that's what your original measure did, it is unclear what you are trying to do, can you please share the pbix file.</description>
      <pubDate>Sat, 04 Jul 2020 16:19:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201404#M19216</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2020-07-04T16:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201433#M19217</link>
      <description>&lt;P&gt;Thanks for your reply. Unfortunately I can't share the pbix file as it is a corporate document.&lt;BR /&gt;Basically, I would like to modify the existing measure (remove that "NA" part) so that when the user is selecting more than one date on the slicer (say, user selects June 2019, July 2019 and August 2019), the measure will output the value for August 2019 (which is the highest date among the 3 dates being selected.). So, if the user selects 2 dates (or more), the measure will output the value of the highest of these 2 dates (or more).&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jul 2020 17:45:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201433#M19217</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-04T17:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201456#M19218</link>
      <description>&lt;P&gt;Are you sure you want to do that? Makes for a bad user experience.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jul 2020 19:26:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1201456#M19218</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-07-04T19:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1202826#M19280</link>
      <description>&lt;P&gt;I understand your point. The thing here is that Active employees refer to the number of active employees at a particular point in time and cannot be cummulative. That Date slicer controls other metrics on the Report and these metrics need cummulative figures (where the user is selecting more than 1 month on the Date slicer).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 06:47:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1202826#M19280</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-06T06:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1203357#M19295</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See if this video helps to get a snapshot of your active employees for a selected time period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=rsx43g7TBBs" target="_blank"&gt;https://www.youtube.com/watch?v=rsx43g7TBBs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;&lt;P&gt;Harsh Nathani&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Appreciate with a Kudos!! (Click the Thumbs Up Button)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 10:03:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1203357#M19295</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-06T10:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1204267#M19326</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// This works on condition that Date_List is
// a Date table marked as such in the model.

Active Employees =
	CALCULATE(
	    SUM( Employee[EmpValue] ),
	    KEEPFILTERS( Employee[Description] = "active" )
	    LASTDATE( Date_List[Date] )
	) + 0
	
// If you don't have dates but only months,
// then you should store something like
// MonthID in your Date_List table and this
// field should be hidden and also monotonically
// increasing. Then you can write:

Active Employees =
	CALCULATE(
	    SUM( Employee[EmpValue] ),
	    KEEPFILTERS( Employee[Description] = "active" )
	    TREATAS(
	    	{MAX( Date_List[MonthID] )},
	    	Date_List[MonthID]
	    ),
	    ALL( Date_List )
	) + 0&lt;/LI-CODE&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;D&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 16:09:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1204267#M19326</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-06T16:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to get max value among selected items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1204542#M19346</link>
      <description>&lt;P&gt;Thanks. Exactly what I was looking for!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 18:27:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-get-max-value-among-selected-items/m-p/1204542#M19346</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-06T18:27:19Z</dc:date>
    </item>
  </channel>
</rss>

