<?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 Time function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Time-function/m-p/1888657#M40679</link>
    <description>&lt;P&gt;Hello to all,&lt;/P&gt;&lt;P&gt;I am writing to you regarding a DAX request:&lt;/P&gt;&lt;P&gt;I have a table calculating the average electricity production according to a chosen period. This table is synchronized with two segments (Years and months) that allow me to choose the period I want to analyze.&lt;BR /&gt;What I would like to do is to add a column to this table that would calculate the average production of the current year (Year N). This would allow me to compare in the same table the values of previous years with the values of the current year.&lt;BR /&gt;The problem is that my segments take over my DAX query even when using an ALL function. Here is my query:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Moyenne corrigée année N (MWh) = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"AVERAGEX(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMMARIZE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES(Dates[Année]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dates[Année],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"E prod",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(SUM(fact_production[Energie produite (kWh)])/1000,fact_production[est_representatif]=TRUE(),YEAR(Dates[Année])=YEAR(TODAY()))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[E prod]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;As you can see below, I did not select the year 2021 so no result is displayed&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If it helps, I have a relationship between a column in my date table and a column in my production table where the electricity production values are:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help,&lt;/P&gt;&lt;P&gt;Have a nice day&lt;/P&gt;&lt;P&gt;Joël&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Jun 2021 16:15:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-06-08T16:15:27Z</dc:date>
    <item>
      <title>Time function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Time-function/m-p/1888657#M40679</link>
      <description>&lt;P&gt;Hello to all,&lt;/P&gt;&lt;P&gt;I am writing to you regarding a DAX request:&lt;/P&gt;&lt;P&gt;I have a table calculating the average electricity production according to a chosen period. This table is synchronized with two segments (Years and months) that allow me to choose the period I want to analyze.&lt;BR /&gt;What I would like to do is to add a column to this table that would calculate the average production of the current year (Year N). This would allow me to compare in the same table the values of previous years with the values of the current year.&lt;BR /&gt;The problem is that my segments take over my DAX query even when using an ALL function. Here is my query:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Moyenne corrigée année N (MWh) = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"AVERAGEX(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMMARIZE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES(Dates[Année]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dates[Année],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"E prod",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(SUM(fact_production[Energie produite (kWh)])/1000,fact_production[est_representatif]=TRUE(),YEAR(Dates[Année])=YEAR(TODAY()))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[E prod]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;As you can see below, I did not select the year 2021 so no result is displayed&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If it helps, I have a relationship between a column in my date table and a column in my production table where the electricity production values are:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help,&lt;/P&gt;&lt;P&gt;Have a nice day&lt;/P&gt;&lt;P&gt;Joël&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jun 2021 16:15:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Time-function/m-p/1888657#M40679</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-08T16:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Time function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Time-function/m-p/1888689#M40681</link>
      <description>&lt;P&gt;Is&amp;nbsp;&lt;SPAN&gt;Moyenne corrigée periode (MWh)&amp;nbsp;a measure that calculates what you want but for the selected time period instead of this year?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If so, does this work (where 'Year Column' is whatever you've used in the Periode prise en compte slicer) ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Moyenne corrigée année N (MWh)&amp;nbsp;=&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CALCULATE(&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;[Moyenne corrigée periode (MWh)],&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;Dates[Year Column]=YEAR(TODAY())&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jun 2021 16:41:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Time-function/m-p/1888689#M40681</guid>
      <dc:creator>PaulOlding</dc:creator>
      <dc:date>2021-06-08T16:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Time function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Time-function/m-p/1890072#M40718</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Indeed it works, thank you very much &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="150936" data-lia-user-login="PaulOlding" class="lia-mention lia-mention-user"&gt;PaulOlding&lt;/a&gt;&amp;nbsp;! Sometimes you don't have to look too hard! ahahah&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a nice day and thanks again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bye&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 08:28:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Time-function/m-p/1890072#M40718</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-09T08:28:39Z</dc:date>
    </item>
  </channel>
</rss>

