<?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: Last value in each category for each group over months in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/768564#M3556</link>
    <description>Sorry but it seems I can't understand your requirements with the current amount of information.&lt;BR /&gt;&lt;BR /&gt;I won't be able to help you. Sorry.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
    <pubDate>Fri, 16 Aug 2019 12:44:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-08-16T12:44:56Z</dc:date>
    <item>
      <title>Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765183#M3391</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data about opportunities. Important columns for my question are OpportunityId, Date, Stage (in what stage opp is - Contacted, Verbal yes...) and Amount. Whenever something about an opportunity changes, its in new row (unchanged values remain the same).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My assignment is that I have to make a chart (Stacked Column Chart in Power BI Desktop) which shows months on rows, values on columns and stage as legend. Also I have a filter that filteres just rows, that shows last stage of every opportunity in each month (if stage changes in one month, I want to see the last one a the last value). Chart should look like this:&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;&amp;nbsp;&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;&lt;P&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;On the first look it seems fine. But when I filter data just for one opportunity, I want to see last stage in every month, not just in months where some change happened:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&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;&lt;P&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;In the picture above there is no data for May. But the opportunity didn't change since April and in May there should be the same value and stage (as in April).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What should I do?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tereza&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 11:12:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765183#M3391</guid>
      <dc:creator>tnovackova</dc:creator>
      <dc:date>2019-08-13T11:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765189#M3393</link>
      <description>&lt;P&gt;Please paste your model layout in here. I want to see how your tables are connected and if you have a proper Date table.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 11:24:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765189#M3393</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-13T11:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765197#M3395</link>
      <description>&lt;P&gt;Hi Darek,&lt;BR /&gt;&lt;BR /&gt;here is my diagram:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;Maybe I didn't explain it correctly. Now the model works fine, there is no mistake, I just want a different result. In my fact table there is no data change for the opportunity (selected in the second picture) in May, but I want to see in every month the last stage and amount (even if in that month there is no new data for that opportunity). I filtered some opportunity just for you to see my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tereza&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 11:34:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765197#M3395</guid>
      <dc:creator>tnovackova</dc:creator>
      <dc:date>2019-08-13T11:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765274#M3398</link>
      <description>&lt;PRE&gt;[Total Amount] = SUM ( FactPipes[Amount] ) -- first basic measure

[Last Value in Period] = -- your final measure
var __lastVisibleDate = MAX ( DimDate[Date] ) -- DimDate[Date] should be related to FactPipes[Date]
var __datesWithValueByOpportunity =
	GENERATE(
		VALUES ( DimOpportunity[DimOpportunityId] ),
		var __lastDateWithValue =
			CALCULATE (
				MAX( FactPipes[Date] ),
				FactPipes[Date] &amp;lt;= __lastVisibleDate,
				ALL( DimDate )
			)
		RETURN
			{ __lastDateWithValue }
	)
var __lastValueInPeriod =
	CALCULATE(
		[Total Amount],
		TREATAS(
			__datesWithValueByOpportunity,
			DimOpportunity[DimOpportunityId],
			DimDate[Date]
		)
	)
RETURN
	__lastValueInPeriod&lt;/PRE&gt;&lt;P&gt;Try this one out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 12:49:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765274#M3398</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-13T12:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765301#M3402</link>
      <description>&lt;P&gt;I tried it and it killed my tabular instance (repeatedly).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 13:08:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765301#M3402</guid>
      <dc:creator>tnovackova</dc:creator>
      <dc:date>2019-08-13T13:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765315#M3406</link>
      <description>Well, you have to re-formulate the measure using different techniques. Either your fact table is too big or your computer is too weak. I'll try to re-write it and post once ready.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Tue, 13 Aug 2019 13:18:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765315#M3406</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-13T13:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765322#M3408</link>
      <description>&lt;P&gt;My fact table has 59 rows, it is really small and just for testing purposes. The whole model is very small. And my computer is a work computer and I work on it with much bigger databases. Maybe the calculation is too complicated, but I am not an expert in DAX at all, so I don't know how to make it better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your help :). If you manage to simplify the formula, it would be awesome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best wishes&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Tereza&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 13:22:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765322#M3408</guid>
      <dc:creator>tnovackova</dc:creator>
      <dc:date>2019-08-13T13:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765338#M3410</link>
      <description>&lt;PRE&gt;[Total Amount] = SUM ( FactPipes[Amount] )


[Last Value in Period] =
var __lastVisibleDate = MAX ( DimDate[Date] )
var __visibleOpportunitiesWithLastDates =
	FILTER(
		ADDCOLUMNS(
			SUMMARIZE(
				FactPipes,
				DimOpportunity[DimOpportunityId]
			),
			"LastDate",
				CALCULATE (
					LASTNONBLANK ( DimDate[Date], [Total Amount] ),
					DimDate[Date] &amp;lt;= __lastVisibleDate
				)
		),
		NOT ISBLANK( [LastDate] )
	)
var __lastValueInPeriod =
	CALCULATE(
		[Total Amount],
		TREATAS(
			__visibleOpportunitiesWithLastDates,
			DimOpportunity[DimOpportunityId],
			DimDate[Date]
		)
	)
RETURN
	__lastValueInPeriod&lt;/PRE&gt;&lt;P&gt;Try the above... How many rows do you have in your fact table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 13:34:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765338#M3410</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-13T13:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765342#M3411</link>
      <description>Can you please paste a link to your file? Please put the file on OneDrive or somewhere I could reach it. Do not use Google Drive as I can't access it from work. I wanna see the crashes. This measure should execute immediately on such a small file.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Tue, 13 Aug 2019 13:38:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765342#M3411</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-13T13:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765348#M3413</link>
      <description>I am sorry, I am not at work anymore. I will try the formula tomorrow. And about the data, I will put it online also tomorrow morning.&lt;BR /&gt;&lt;BR /&gt;Thank you for your help&lt;BR /&gt;&lt;BR /&gt;Tereza</description>
      <pubDate>Tue, 13 Aug 2019 13:45:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765348#M3413</guid>
      <dc:creator>tnovackova</dc:creator>
      <dc:date>2019-08-13T13:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765439#M3422</link>
      <description>&lt;P&gt;Here's another measure that returns exactly the same results as the previous one (I've created a model and checked it):&lt;/P&gt;&lt;PRE&gt;Last Value in Period = 
var __lastVisibleDate = MAX ( DimDate[Date] )
var __visibleOpportunitiesWithLastDates =
	FILTER(
		ADDCOLUMNS(
                        VALUES( DimOpportunity[OpportunityId] ),
			"LastDate",
				CALCULATE (
					LASTNONBLANK( DimDate[Date], [Total Amount] ),
					DimDate[Date] &amp;lt;= __lastVisibleDate
				)
		),
		NOT ISBLANK( [LastDate] )
	)
var __lastValueInPeriod =
	CALCULATE(
	    [Total Amount],
            TREATAS (
                __visibleOpportunitiesWithLastDates,
                DimOpportunity[OpportunityId],
                DimDate[Date]
            )
    )
RETURN
	__lastValueInPeriod&lt;/PRE&gt;&lt;P&gt;There are no crashes for any of the two measures. They work like magic returning the same thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 14:54:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/765439#M3422</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-13T14:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/766046#M3451</link>
      <description>&lt;P&gt;Hi Darek,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, this also works, but it does YTD and I need actual stage of an opportunity:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In this picture you can see that the stages are YTD. But an opportunity has only one stage at a time. I need to see only the max stage for every month. Is that possible?&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;Tereza&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 06:58:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/766046#M3451</guid>
      <dc:creator>tnovackova</dc:creator>
      <dc:date>2019-08-14T06:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/766222#M3459</link>
      <description>It's definitely not YTD. If you select a period of time, it'll return the sum of the latest amounts for all the opportunities in the current context, where "latest amount" means the most current amount as visible before or on the last date visible in the current context. I've checked it. Try to slice by one opportunity at a time and see what you get.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Wed, 14 Aug 2019 09:03:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/766222#M3459</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-14T09:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/768456#M3553</link>
      <description>&lt;P&gt;Hi Darek,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sorry for the late reply but I was out of office. When I filter just one opportunity (number 1), I see a chart that I send you earlier (tha last picture). And there is for every month every stage that the opportunity have had. I need just the last stage (with the biggest ID). Is it possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Tereza&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 10:01:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/768456#M3553</guid>
      <dc:creator>tnovackova</dc:creator>
      <dc:date>2019-08-16T10:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Last value in each category for each group over months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/768564#M3556</link>
      <description>Sorry but it seems I can't understand your requirements with the current amount of information.&lt;BR /&gt;&lt;BR /&gt;I won't be able to help you. Sorry.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Fri, 16 Aug 2019 12:44:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-in-each-category-for-each-group-over-months/m-p/768564#M3556</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-16T12:44:56Z</dc:date>
    </item>
  </channel>
</rss>

