<?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 for latest month based on selected filters in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960105#M42849</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;I understand what you said about not having the month in the fact table.&lt;/P&gt;&lt;P&gt;But then how do I do when the Calendar has more months than there is data in my fact table?&lt;/P&gt;&lt;P&gt;For example, the Calendar goes up to August, but I have only data until July.&lt;/P&gt;&lt;P&gt;With the way you have done it, it will return nothing, because it will be getting data for August and there is none.&lt;/P&gt;&lt;P&gt;That's why I had it there and was trying to use it. Doesn't mean it is right, just explaining the reason why.&lt;/P&gt;&lt;P&gt;Any idea how can I overcome that.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 14:14:47 GMT</pubDate>
    <dc:creator>afbraga66</dc:creator>
    <dc:date>2021-07-15T14:14:47Z</dc:date>
    <item>
      <title>DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1959641#M42819</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am trying to get the duration minutes for the lastest month of the selected months in a slicer. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In case none is &lt;/SPAN&gt;&lt;SPAN&gt;selected then it should consider the latest month/max.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Currently I have the formula below, but it is clearly not working. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Also DOWNTIME[MONTH] is a numeric field (1,2,3,...,12), so I would probably have to convert D_Calendar[Month] before evaluating.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;mDurationLatestSelectedMonths(min) = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(sum(DOWNTIME[Duration Minutes]),KEEPFILTERS(DOWNTIME[MONTH]=VALUES(D_Calendar[Month])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;André&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Jul 2021 10:26:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1959641#M42819</guid>
      <dc:creator>afbraga66</dc:creator>
      <dc:date>2021-07-15T10:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1959700#M42827</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;mDurationLatestSelectedMonths(min) =
// MonthID must be a unique number
// that identifes months across
// years. Best to number them from
// 1 up to the number of all months in
// the calendar. It is very important
// to have such a column in you date dimension.
// Your fact table should not have
// a month in it but a suitable Date,
// a key from your calendar. Calendars
// should ALWAYS be on the date granularity
// even if you only need months. ALWAYS.
var SelectedMonthOrMaxMonth = MAX( D_Calendar[MonthID] )
var NewTimeFilter =
	CALCULATETABLE(
		DISTINCT( D_Calendar[Date] ),
		D_Calendar[MonthID] = SelectedMonthOrMaxMonth,
		REMOVEFILTERS( D_Calendar )
	)
var Result =
	CALCULATE(
	    SUM( DOWNTIME[Duration Minutes] ),
	    NewTimeFilter
	)
return
	Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 11:06:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1959700#M42827</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-15T11:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960105#M42849</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;I understand what you said about not having the month in the fact table.&lt;/P&gt;&lt;P&gt;But then how do I do when the Calendar has more months than there is data in my fact table?&lt;/P&gt;&lt;P&gt;For example, the Calendar goes up to August, but I have only data until July.&lt;/P&gt;&lt;P&gt;With the way you have done it, it will return nothing, because it will be getting data for August and there is none.&lt;/P&gt;&lt;P&gt;That's why I had it there and was trying to use it. Doesn't mean it is right, just explaining the reason why.&lt;/P&gt;&lt;P&gt;Any idea how can I overcome that.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 14:14:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960105#M42849</guid>
      <dc:creator>afbraga66</dc:creator>
      <dc:date>2021-07-15T14:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960133#M42851</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;I understand what you said about not having the month in the fact table.&lt;/P&gt;&lt;P&gt;But then how do I do when the Calendar has more months than there is data in my fact table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; What you do depends on what you want to do. You have to define what you want.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the Calendar goes up to August, but I have only data until July.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; Calendars MUST always contain full years. They can't just go up to some date. They have to go to the last day of a year.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the way you have done it, it will return nothing, because it will be getting data for August and there is none.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; Is this a problem? Since there's no data, no data is returned. Makes sense.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's why I had it there and was trying to use it. Doesn't mean it is right, just explaining the reason why.&lt;/P&gt;&lt;P&gt;Any idea how can I overcome that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;You can always filter your slicer(s) via Fiter Pane to only show what you want.&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 14:23:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960133#M42851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-15T14:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960170#M42852</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; What you do depends on what you want to do. You have to define what you want.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Yes, I agree.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; Calendars MUST always contain full years. They can't just go up to some date. They have to go to the last day of a year.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Indeed. I was just using August as an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; Is this a problem? Since there's no data, no data is returned. Makes sense.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Well it is, because once I put the data on a table it will only show data for months that have data. And then I wan to use another metric to sort descending by the latest month in which there is data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 14:38:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960170#M42852</guid>
      <dc:creator>afbraga66</dc:creator>
      <dc:date>2021-07-15T14:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960287#M42859</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="297582" data-lia-user-login="afbraga66" class="lia-mention lia-mention-user"&gt;afbraga66&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I mentioned, you could always filter the whole visual, page or even the whole report to only show your dates up to the last one that has data. This is not a problem.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 15:27:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960287#M42859</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-15T15:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960821#M42884</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to do the expression you carefully made.&lt;/P&gt;&lt;P&gt;This is the result of the expression. The total is correct, but I expected it to give only values for July. How can I achieve that maintaining the same idea?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 20:42:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1960821#M42884</guid>
      <dc:creator>afbraga66</dc:creator>
      <dc:date>2021-07-15T20:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1961727#M42909</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//I am trying to get the duration
// minutes for the latest month
// of the selected months in a slicer.
// In case none is selected, then it
// should consider the latest month/max.

[Total Downtime] = SUM( Downtime[Duration Minutes] )

// Please be aware that this measure is
// sensitive to all selections in all
// dimensions.
[Your Measure] =
SWITCH( true(),

	ISCROSSFILTERED( 'D_Calendar' ),
		// If the calendar is filtered/crossfiltered,
		// then we grab the max month visible across
		// the whole selection of dates (not only
		// the current one).
		var LastVisibleMonth =
			CALCULATE(
				MAXX( 'D_Calendar'[MonthId] ),
				ALLSELECTED( 'D_Calendar' )
			)
		// Then we check if the currently visible
		// period of time is fully contained within
		// the last visible month.
		var IsCurrentPeriodContainedInLastVisibleMonth =
			SELECTEDVALUE( 'D_Calendar'[MonthId] )
				= LastVisibleMonth
		var Result = 
			// ... and if it is, we calculate the
			// corresponding downtime, otherwise we
			// return blank.
			if( IsCurrentPeriodContainedInLastVisibleMonth,
				[Total Downtime]
			)
		return
			Result,
		
	// If the Calendar is not filtered/crossfiltered,
	// we just grab the very last month for which
	// there is data in Downtime, and return the
	// total downtime in this very month.
	var VeryLastMonthWithDowntime = 
		CALCULATE(
			MAXX(
				SUMMARIZE(
					Downtime,
					D_Calendar[MonthID]
				),
				D_Calendar[MonthID]
			),
			REMOVEFILTERS( )
		)
	var Result =
		CALCULATE(
			[Total Downtime],
			'D_Calendar'[MonthID] = VeryLastMonthWithDowntime
		)
	return
		Result
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 09:40:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1961727#M42909</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-16T09:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1961933#M42917</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for helping me, you are awesome.&lt;/P&gt;&lt;P&gt;This seems to be working, the only issue I am having now is that when I try to sort by descending it is not actually sorting. Any idea why the numbers are not sorted and the nulls don't come in last?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 11:15:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1961933#M42917</guid>
      <dc:creator>afbraga66</dc:creator>
      <dc:date>2021-07-16T11:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1961975#M42921</link>
      <description>&lt;P&gt;The visual does not sort because it does not know which column you're talking about since there are many columns with the same name. So, do I have to sort by the "last month" column in 5, 6 or 7? Or maybe under Total? Since its a column in matrix you can try to click the header over the correct column.... it may then sort it.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 11:38:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1961975#M42921</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-16T11:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962021#M42923</link>
      <description>&lt;P&gt;It looks like the matrix can only sort by the Total, not by individual columns.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 11:50:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962021#M42923</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-16T11:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962091#M42927</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because matrix only sorts by total, that's why I was trying to develop this formula for the latest month (5-May, 6-June, 7-July). Then I would had the formula to the values, hide it with word wrap off and sort descending by it. When I first tried I used this code to test it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;mDurationLatestMonth(min) = CALCULATE(sum(DOWNTIME[Duration Minutes]),KEEPFILTERS(DOWNTIME[MES_FABRIL]=MONTH(TODAY())))&lt;/LI-CODE&gt;&lt;P&gt;It works, but is fixed to today and sometimes there is no data yet for today, hence me opening this question for help in trying to get the max month dynamically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 12:08:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962091#M42927</guid>
      <dc:creator>afbraga66</dc:creator>
      <dc:date>2021-07-16T12:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962173#M42928</link>
      <description>&lt;P&gt;Why are there no numbers in the Total column for the "last month" measure? Have you applied a filter to the visual/page/report to only go with dates in the date dimension as far as the last month for which there is data in Downtime? You have to have a column in your date dimension that says True for dates before or in the last month present in Downtime and False otherwise. Then you'll filter by this column in the Filter Pane and you'll get what you're after.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 12:22:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962173#M42928</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-16T12:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962334#M42940</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok, so I took the time to build a mock up file to be easier I think. It only has one table and with no Calendar dimension on purpose. I know it is not how data models are built, but just for this example I want to do it only with that table. The file is in here &lt;A href="https://we.tl/t-XlZUWPgAKL" target="_blank"&gt;https://we.tl/t-XlZUWPgAKL&lt;/A&gt; (couldn't find how to upload it in the reply).&lt;/P&gt;&lt;P&gt;So I want to sort by month number 5, 6&amp;nbsp; or 7 depeding on which is the latest according to my filters or absence of filtering, and for that I need to create a formula that gives me just that. So that when I add it to the matrix I will have two formulas. One that gives values for all the months, and one that just gives for the latest. Then I sort by that one, and hide it from the matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 13:53:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962334#M42940</guid>
      <dc:creator>afbraga66</dc:creator>
      <dc:date>2021-07-16T13:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962356#M42941</link>
      <description>&lt;P&gt;Wait! So you're saying that you want to sort the columns, not rows! That's a whole different story. I have never seen this would be possible anywhere and I don't think it would be possible here whatever you do. It's just not gonna happen. Matrices don't have this ability however hard you try. &lt;STRONG&gt;I'd like to be proven wrong. Really.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 14:01:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962356#M42941</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-16T14:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962397#M42944</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In the example I gave I have this in the image below. It is being sorted by the total value, that's what power bi does out of the box. I don't want that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I want it to look like this. Of course I would hide the second formula then.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I did that with this second formula:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Today Month = CALCULATE([mDuration(min)], KEEPFILTERS(DOWNTIME[MES_FABRIL]=MONTH(TODAY())))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this is fixed to todays month, and I can't have it like that. I want it to have the dynamic filtering that I explained before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 14:17:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962397#M42944</guid>
      <dc:creator>afbraga66</dc:creator>
      <dc:date>2021-07-16T14:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962430#M42949</link>
      <description>&lt;P&gt;OK, I don't understand. You said you wanted to sort the columns, not rows, meaning you wanted to dynamically change the order of the columns based on some value. Now it seems you want to sort rows and leave the columns intact. Sorry, I don't follow. I told you exactly what to do to get the total to be my measure and then sort rows by it. Can't do much more. Sorry.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 14:30:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962430#M42949</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-16T14:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for latest month based on selected filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962451#M42953</link>
      <description>&lt;P&gt;What I always wanted is in my latest post and in the file I provided if you could please look into it? I apoligize if I made it confusing for you. I am pretty new to this and I have difficulty in DAX, hence asking for help. Sorry.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 14:41:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-latest-month-based-on-selected-filters/m-p/1962451#M42953</guid>
      <dc:creator>afbraga66</dc:creator>
      <dc:date>2021-07-16T14:41:23Z</dc:date>
    </item>
  </channel>
</rss>

