<?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 YTD or other time intelligence calculation in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-or-other-time-intelligence-calculation/m-p/1806804#M38142</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to ask you about specyfic case. My examle &lt;img /&gt;is below. I need to have some YTD calculation across multiple years. It means that I want to see one column "Opening balance" it is not standard functionality OPENINGBALANCE in DAX, it need to be sth more. Opening balance for current month&amp;nbsp; is closing balance for previous month, and closing balance is YTD calculation but I must have this value from the beggining of the world&amp;nbsp; till now, so&amp;nbsp; it is not only current year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I prepare closing balance in DAX like&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;CALCULATE(SUM(BANKACCLEDGENTR[Amount_LCY]),DATESYTD('Calendar'[Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and opening&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE([closing balance],PREVIOUSMONTH('Calendar'[Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but how to get correct result in the next year.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 26 Apr 2021 18:06:25 GMT</pubDate>
    <dc:creator>ola1996</dc:creator>
    <dc:date>2021-04-26T18:06:25Z</dc:date>
    <item>
      <title>YTD or other time intelligence calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-or-other-time-intelligence-calculation/m-p/1806804#M38142</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to ask you about specyfic case. My examle &lt;img /&gt;is below. I need to have some YTD calculation across multiple years. It means that I want to see one column "Opening balance" it is not standard functionality OPENINGBALANCE in DAX, it need to be sth more. Opening balance for current month&amp;nbsp; is closing balance for previous month, and closing balance is YTD calculation but I must have this value from the beggining of the world&amp;nbsp; till now, so&amp;nbsp; it is not only current year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I prepare closing balance in DAX like&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;CALCULATE(SUM(BANKACCLEDGENTR[Amount_LCY]),DATESYTD('Calendar'[Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and opening&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE([closing balance],PREVIOUSMONTH('Calendar'[Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but how to get correct result in the next year.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Apr 2021 18:06:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-or-other-time-intelligence-calculation/m-p/1806804#M38142</guid>
      <dc:creator>ola1996</dc:creator>
      <dc:date>2021-04-26T18:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: YTD or other time intelligence calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-or-other-time-intelligence-calculation/m-p/1807074#M38156</link>
      <description>&lt;LI-CODE lang="csharp"&gt;// You should adjust the names of
// the tables and columns to fit
// your model. These measures work
// correctly for any selection of
// periods, not only months.
 
[Closing Balance] =
var LastVisibleDate = MAX( 'Calendar'[Date] )
var Result =
    CALCULATE(
        SUM( T[Amount] ),
        'Calendar'[Date] &amp;lt;= LastVisibleDate,
        // This last line is not needed
        // if 'Calendar' is a date table
        // that's been marked in the model
        // as a proper date table.
        ALL( 'Calendar' )
    )
return
    Result
    
// Opening Balance

[Opening Balance] =
var FirstVisibleDate = MIN( 'Calendar'[Date] )
var DayBeforeFirstVisibleDate =
    FirstVisibleDate - 1
var Result =
    CALCULATE(
        [Closing Balance],
        'Calendar'[Date] = DayBeforeFirstVisibleDate,
        // Same remark as above applies...
        ALL( 'Calendar' )
    )
return
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 26 Apr 2021 20:54:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-or-other-time-intelligence-calculation/m-p/1807074#M38156</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-26T20:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: YTD or other time intelligence calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-or-other-time-intelligence-calculation/m-p/1816085#M38435</link>
      <description>&lt;P&gt;Unfortunatelly, I put this formulas in mine .pbix and not working correctly&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 07:56:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-or-other-time-intelligence-calculation/m-p/1816085#M38435</guid>
      <dc:creator>ola1996</dc:creator>
      <dc:date>2021-04-30T07:56:57Z</dc:date>
    </item>
  </channel>
</rss>

