<?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 Calculate the sum of values for a year with start date and end date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculate-the-sum-of-values-for-a-year-with-start-date-and/m-p/2352944#M59802</link>
    <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;, thank you very much for this answer,&lt;BR /&gt;after Yearly = var _year = YEAR(&lt;SPAN&gt;Table[StartDate]&lt;/SPAN&gt;)&lt;BR /&gt;StartDate is not a measure I can not put this value in parameter I do not understand why&lt;/P&gt;</description>
    <pubDate>Tue, 22 Feb 2022 09:26:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-02-22T09:26:57Z</dc:date>
    <item>
      <title>DAX Calculate the sum of values for a year with start date and end date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculate-the-sum-of-values-for-a-year-with-start-date-and/m-p/2352850#M59796</link>
      <description>&lt;P&gt;I can't manage in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;DAX&lt;/STRONG&gt;, to calculate for a year, the sum of the values which are in this year, I would like the proportion of each of the values in a year according to its starting date and its ending date.&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Milestone Phase&lt;/TD&gt;&lt;TD&gt;Start Date&lt;/TD&gt;&lt;TD&gt;End Date&lt;/TD&gt;&lt;TD&gt;Workload&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;0-1&lt;/TD&gt;&lt;TD&gt;3/30/2020&lt;/TD&gt;&lt;TD&gt;12/10/2021&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;TD&gt;12/10/2021&lt;/TD&gt;&lt;TD&gt;01/03/2022&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2-3&lt;/TD&gt;&lt;TD&gt;01/03/2022&lt;/TD&gt;&lt;TD&gt;07/01/2022&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;0-1&lt;/TD&gt;&lt;TD&gt;01/02/2019&lt;/TD&gt;&lt;TD&gt;05/05/2021&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;TD&gt;05/05/2021&lt;/TD&gt;&lt;TD&gt;06/06/2022&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2-3&lt;/TD&gt;&lt;TD&gt;06/06/2022&lt;/TD&gt;&lt;TD&gt;10/12/2023&lt;/TD&gt;&lt;TD&gt;600&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I want to be able to calculate for each year, the value of the "workload" during that year, so in 2019 the share of 150 between 01/02/2019 and the end of the year then the share of 150 between 01/01/2020 and 12/31/2020 then the share between 01/01/2021 and 05/05/2021 (without forgetting the phase 1-2 and the other IDs obviously).&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 08:28:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculate-the-sum-of-values-for-a-year-with-start-date-and/m-p/2352850#M59796</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-22T08:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Calculate the sum of values for a year with start date and end date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculate-the-sum-of-values-for-a-year-with-start-date-and/m-p/2352907#M59800</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;You can achive this by removing filters from date using ALL and then use variables to get values for a set year. E.g.&lt;BR /&gt;&lt;BR /&gt;Yearly = var _year = YEAR(Table[StartDate]) return&lt;BR /&gt;CALCULATE(SUM(table[workload]),ALL(Table[StartDate]),YEAR(Table[StartDate])=_year)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;After you have this yearly value you can calculate the row context dependand value by using a simple SUM calculation and then use DIVIDE(SUM(table[workload]),[Yearly])&lt;BR /&gt;&lt;BR /&gt;Ping me with&amp;nbsp;@ if I have misunderstood something or you have questions.&lt;BR /&gt;&lt;BR /&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;My LinkedIn: &lt;A href="https://www.linkedin.com/in/n%C3%A4ttiahov-00001/" target="_blank"&gt;https://www.linkedin.com/in/n%C3%A4ttiahov-00001/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 08:50:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculate-the-sum-of-values-for-a-year-with-start-date-and/m-p/2352907#M59800</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-02-22T08:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Calculate the sum of values for a year with start date and end date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculate-the-sum-of-values-for-a-year-with-start-date-and/m-p/2352944#M59802</link>
      <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;, thank you very much for this answer,&lt;BR /&gt;after Yearly = var _year = YEAR(&lt;SPAN&gt;Table[StartDate]&lt;/SPAN&gt;)&lt;BR /&gt;StartDate is not a measure I can not put this value in parameter I do not understand why&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 09:26:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculate-the-sum-of-values-for-a-year-with-start-date-and/m-p/2352944#M59802</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-22T09:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Calculate the sum of values for a year with start date and end date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculate-the-sum-of-values-for-a-year-with-start-date-and/m-p/2353089#M59811</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is a typical Decompose / Reassemble puzzle. Here is your sample file with the solution&amp;nbsp;&lt;A href="https://www.dropbox.com/t/X0qzLVDaKr12wTFl" target="_blank" rel="noopener"&gt;https://www.dropbox.com/t/UstztAstnn94u8hK&lt;/A&gt;&lt;BR /&gt;You need to create a new table at the "Day" granularity. The following code calculates this table with daily workload.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Workload Per Day = 
VAR PerDayWorkload =
    ADDCOLUMNS (
        Workload,
        "Workload/Day", DIVIDE ( Workload[Workload], DATEDIFF ( Workload[Start Date], Workload[End Date], DAY ) )
    )
VAR DailyTable =
    CROSSJOIN ('Date', PerDayWorkload )
VAR Result = 
    FILTER (
        DailyTable,
        [Date] &amp;gt;= [Start Date]
            &amp;amp;&amp;amp; [Date] &amp;lt;= [End Date]
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simply use the new table to build a relationship with the Date table&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;Your measure is simply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Workload Measure = SUM ('Workload Per Day'[Workload/Day] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can build you report and slice the way you like&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;Please let me know if this answers your query. Have a great day!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 10:06:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculate-the-sum-of-values-for-a-year-with-start-date-and/m-p/2353089#M59811</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-22T10:06:40Z</dc:date>
    </item>
  </channel>
</rss>

