<?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 Date/hour table - Create measure of day average depending on slicers in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-hour-table-Create-measure-of-day-average-depending-on/m-p/3985301#M154504</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;My request is a bit "tricky" so i tried to simplified it the most.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data ("Value") are stored in a date/hour database, with a value each hour.&lt;/P&gt;&lt;P&gt;I created a date/time table to link all my data.&lt;/P&gt;&lt;P&gt;I want to show a table with :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;first column = date/day/hour&lt;/LI&gt;&lt;LI&gt;second column = maximum hour values&lt;/LI&gt;&lt;LI&gt;third column = day average value (measure)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;day_average = 
AVERAGEX( ALL(Table_date[Date_heure]), CALCULATE( [Value], VALUES (Table_date[Date] ) ))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table will be "filtered" by slicers, especially "hour" slicer, which will reduce the size of a the days.&lt;/P&gt;&lt;P&gt;To do so, I already created measures, but I’m facing an issue.&lt;/P&gt;&lt;P&gt;The measure that calculates the "day average" values works. But it is not affected by slicers. If I want to shorten day with the slicer by 10h-19h instead of 0h-23h, the result of this measure will not change. I tried to replace&amp;nbsp; the&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ALL()&lt;/LI-CODE&gt;&lt;P&gt;by&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ALLSELECTED()&lt;/LI-CODE&gt;&lt;P&gt;whitout any change of the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found a "workaround" (right table in the image) wich consists of showing a table with date/day lines (instead of date/time/hour). I add a mesure to calculate the max value of a day, and the average value. The results of these two measures are properly affected by slicers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, for the date/hour table, how can I write a mesure which will calculate the day average, and take care of slicers values ?&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;Thanks for your help.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2024 07:36:27 GMT</pubDate>
    <dc:creator>Atiroocky</dc:creator>
    <dc:date>2024-06-11T07:36:27Z</dc:date>
    <item>
      <title>Date/hour table - Create measure of day average depending on slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-hour-table-Create-measure-of-day-average-depending-on/m-p/3985301#M154504</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;My request is a bit "tricky" so i tried to simplified it the most.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data ("Value") are stored in a date/hour database, with a value each hour.&lt;/P&gt;&lt;P&gt;I created a date/time table to link all my data.&lt;/P&gt;&lt;P&gt;I want to show a table with :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;first column = date/day/hour&lt;/LI&gt;&lt;LI&gt;second column = maximum hour values&lt;/LI&gt;&lt;LI&gt;third column = day average value (measure)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;day_average = 
AVERAGEX( ALL(Table_date[Date_heure]), CALCULATE( [Value], VALUES (Table_date[Date] ) ))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table will be "filtered" by slicers, especially "hour" slicer, which will reduce the size of a the days.&lt;/P&gt;&lt;P&gt;To do so, I already created measures, but I’m facing an issue.&lt;/P&gt;&lt;P&gt;The measure that calculates the "day average" values works. But it is not affected by slicers. If I want to shorten day with the slicer by 10h-19h instead of 0h-23h, the result of this measure will not change. I tried to replace&amp;nbsp; the&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ALL()&lt;/LI-CODE&gt;&lt;P&gt;by&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ALLSELECTED()&lt;/LI-CODE&gt;&lt;P&gt;whitout any change of the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found a "workaround" (right table in the image) wich consists of showing a table with date/day lines (instead of date/time/hour). I add a mesure to calculate the max value of a day, and the average value. The results of these two measures are properly affected by slicers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, for the date/hour table, how can I write a mesure which will calculate the day average, and take care of slicers values ?&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;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 07:36:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-hour-table-Create-measure-of-day-average-depending-on/m-p/3985301#M154504</guid>
      <dc:creator>Atiroocky</dc:creator>
      <dc:date>2024-06-11T07:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Date/hour table - Create measure of day average depending on slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-hour-table-Create-measure-of-day-average-depending-on/m-p/3985373#M154506</link>
      <description>&lt;P&gt;As I continue to investigate by my side, I think I found out the issue.&lt;/P&gt;&lt;P&gt;Sometimes, the "Value" (which is calculated) is shown as "infiny"&lt;/P&gt;&lt;P&gt;When I get rid of the "infiny" value in the filter pannel, and replace ALL by ALLSELECTED in the measure, it finally works !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;day_average = 
AVERAGEX( ALLSELECTED(Table_date[Date_heure]), CALCULATE( [Value], VALUES (Table_date[Date] ) ))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 08:08:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-hour-table-Create-measure-of-day-average-depending-on/m-p/3985373#M154506</guid>
      <dc:creator>Atiroocky</dc:creator>
      <dc:date>2024-06-11T08:08:43Z</dc:date>
    </item>
  </channel>
</rss>

