<?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: Measures/calculated columns to show max value with date, and latest date with value. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1398916#M25713</link>
    <description>&lt;P&gt;This would do the trick:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;___IsHighestOftheDay	 = 	var _tblSum = SUMMARIZE('Table','Table'[Date]//,'Table'[Item],'Table'[Location]
,'Table'[% of total of the day], "H",  CALCULATE(MAX([% of total of the day]), ALLEXCEPT('Table',//'Table'[Location],
'Table'[Date])))
return 
COUNTROWS(FILTER(_tblSum,[% of total of the day]=[H]))
__LatestDate	 = 	CALCULATE(MAX([Date]),ALLEXCEPT('Table','Table'[Location],'Table'[Item]))
___LatestDateWithHighestPosition	 = 	CALCULATE(MAX([Date]), FILTER(ALLEXCEPT('Table','Table'[Location],'Table'[Item]),[___IsHighestOftheDay]=1))
___LatestPercValithHighestPosition	 = 	CALCULATE(MAX([% of total of the day]), FILTER(ALLEXCEPT('Table','Table'[Location],'Table'[Item]),[___IsHighestOftheDay]=1))
___LatestDateWithHighestPosition = CALCULATE(MAX([Date]), FILTER(ALLEXCEPT('Table','Table'[Location],'Table'[Item]),[___IsHighestOftheDay]=1))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As seen here:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;File is available &lt;A href="https://1drv.ms/u/s!AvU6hhKLfmEcgsZeU3_oP-4ZiuxN-w?e=u8vLfY" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;pls mark as solution if so. Thumbs up for the effort is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 05:38:51 GMT</pubDate>
    <dc:creator>stevedep</dc:creator>
    <dc:date>2020-09-29T05:38:51Z</dc:date>
    <item>
      <title>Measures/calculated columns to show max value with date, and latest date with value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1398833#M25709</link>
      <description>&lt;P&gt;Hi I have a sample scenerio data set(actual data set used has thousands of rows):&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Location&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Item&lt;/TD&gt;&lt;TD&gt;% of total of the day&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;East&lt;/TD&gt;&lt;TD&gt;1/1/2012&lt;/TD&gt;&lt;TD&gt;Burger&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;1/1/2012&lt;/TD&gt;&lt;TD&gt;Burger&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;North&lt;/TD&gt;&lt;TD&gt;1/1/2012&lt;/TD&gt;&lt;TD&gt;Burger&lt;/TD&gt;&lt;TD&gt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&lt;/TD&gt;&lt;TD&gt;70&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;BR /&gt;So i have 2 slicers to select the menu item and location. And i want to add card/table to show for example:&lt;/DIV&gt;&lt;DIV&gt;Slicer option selected: Burger and East.&lt;/DIV&gt;&lt;DIV&gt;Results shown:&lt;/DIV&gt;&lt;DIV&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Latest Date&lt;/TD&gt;&lt;TD&gt;2/1/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;% of the total of the day&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;40&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date of Max % of the total of the day&lt;/TD&gt;&lt;TD&gt;1/1/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Max % of the total of the day&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;If understand what this means, it's basically to monitor the latest date for the selected item(due note there are hundreds of items and some items are not regular items) and location, together with the value of&amp;nbsp; % of the total of the day;&lt;/DIV&gt;&lt;DIV&gt;And to see which date have the highest % of the total of the day together with max % value.&lt;/DIV&gt;&lt;DIV&gt;So any ideas/ measures/calculated columns to help with creating a card/table to show the above results?&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:05:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1398833#M25709</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-28T09:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Measures/calculated columns to show max value with date, and latest date with value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1398916#M25713</link>
      <description>&lt;P&gt;This would do the trick:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;___IsHighestOftheDay	 = 	var _tblSum = SUMMARIZE('Table','Table'[Date]//,'Table'[Item],'Table'[Location]
,'Table'[% of total of the day], "H",  CALCULATE(MAX([% of total of the day]), ALLEXCEPT('Table',//'Table'[Location],
'Table'[Date])))
return 
COUNTROWS(FILTER(_tblSum,[% of total of the day]=[H]))
__LatestDate	 = 	CALCULATE(MAX([Date]),ALLEXCEPT('Table','Table'[Location],'Table'[Item]))
___LatestDateWithHighestPosition	 = 	CALCULATE(MAX([Date]), FILTER(ALLEXCEPT('Table','Table'[Location],'Table'[Item]),[___IsHighestOftheDay]=1))
___LatestPercValithHighestPosition	 = 	CALCULATE(MAX([% of total of the day]), FILTER(ALLEXCEPT('Table','Table'[Location],'Table'[Item]),[___IsHighestOftheDay]=1))
___LatestDateWithHighestPosition = CALCULATE(MAX([Date]), FILTER(ALLEXCEPT('Table','Table'[Location],'Table'[Item]),[___IsHighestOftheDay]=1))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As seen here:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;File is available &lt;A href="https://1drv.ms/u/s!AvU6hhKLfmEcgsZeU3_oP-4ZiuxN-w?e=u8vLfY" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;pls mark as solution if so. Thumbs up for the effort is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 05:38:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1398916#M25713</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2020-09-29T05:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Measures/calculated columns to show max value with date, and latest date with value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1400815#M25779</link>
      <description>&lt;P&gt;Hi , thank you for the reply, but I don't think this is the outcome I would want. To make it clearer, let me re explain,&lt;/P&gt;&lt;DIV&gt;I have two slicers, one for the item and another for the location.&lt;/DIV&gt;&lt;DIV&gt;For example my Slicer option selected: Burger and East.&lt;/DIV&gt;&lt;DIV&gt;I want to have a way to show these results:&lt;/DIV&gt;&lt;DIV&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Latest Date&lt;/TD&gt;&lt;TD&gt;2/1/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;% of the total of the day&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;40&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date of Max % of the total of the day&amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1/1/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Max % of the total of the day&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to be able to select the menu and the location, and see when was the latest date that menu item was sold and how much % was it sold on that day. And in addition, also be able to see in the past history the date which had that menu item having the highest % of the day amoung all the other dates, so i can know whats the highest % I've ever sold on a day for that item and at that location.&lt;/P&gt;&lt;P&gt;Burger and fries are a simplified version of the actual data, the actual data has thousand of rows with years of data, each day there are like 20 items. And every day the items change. Hope this clarifies.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 29 Sep 2020 03:46:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1400815#M25779</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-29T03:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Measures/calculated columns to show max value with date, and latest date with value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1400925#M25781</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, I was a bit to quick with my initial response. I updated my response, pls take a look and see if this works for you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards, Steve.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 05:34:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1400925#M25781</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2020-09-29T05:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Measures/calculated columns to show max value with date, and latest date with value.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1408417#M26062</link>
      <description>&lt;P&gt;Hi sorry for the late reply, the solution presented has helped solved part of this proble. I found a simpler solution butit is not completed.&lt;BR /&gt;measure for&amp;nbsp;&lt;SPAN&gt;Max % of the total of the day:&lt;BR /&gt;Max % of the total of the day =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE(MAX('data'[% of total of the day]),ALLEXCEPT('data'&lt;/SPAN&gt;&lt;SPAN&gt;,'data'[location],'data'[item]))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;measure for&amp;nbsp;&lt;SPAN&gt;Date of Max % of the total of the day:&lt;BR /&gt;Date of Max % of the total of the day =&lt;/SPAN&gt;&lt;SPAN&gt;LOOKUPVALUE('data'[Date],'data'[% of total of the day],[Max % of total of the day])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;measure for latest date:&lt;BR /&gt;&lt;SPAN&gt;Latest Date =&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE(LASTDATE('data'[date]),ALLEXCEPT('data','data'[item],'data'[location]))&lt;BR /&gt;&lt;BR /&gt;But for the corresponding value which is&amp;nbsp;&lt;SPAN&gt;% of the total of the day, i thought I could use the same measure(lookupvalue) as&amp;nbsp;Date of Max % of the total of the day, but it gave me an error, this was the DAX I used:&lt;BR /&gt;&amp;nbsp;% of the total of the day for latest date = LOOKUPVALUE('data'[% of the total of the day],'data'[date],[Latest Date])&lt;BR /&gt;So I'm now focusing on solving this last problem, I started a new thread focusing more on it with more information of the scenerio:, link is below:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/DAX-Commands-and-Tips/Last-value-of-a-calculated-column-based-on-slicer-options/m-p/1407303#M26005" target="_self"&gt;Last value of a calculated column based on slicer options.&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 01:46:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measures-calculated-columns-to-show-max-value-with-date-and/m-p/1408417#M26062</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-02T01:46:53Z</dc:date>
    </item>
  </channel>
</rss>

