<?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: Creating calculated columns which show value from four different intervals in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-calculated-columns-which-show-value-from-four-different/m-p/3164666#M113764</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="538299" data-lia-user-login="MathiasBI" class="lia-mention lia-mention-user"&gt;MathiasBI&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please have a try.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;column =
VAR _1 = table[date]
VAR _2 =
    DATEDIFF ( _1, TODAY (), DAY )
RETURN
    IF (
        _2 &amp;lt;= 30
            &amp;amp;&amp;amp; _2 &amp;gt;= 0 = 0,
        "Today - 1 month to date",
        IF (
            _2 &amp;lt;= 60
                &amp;amp;&amp;amp; _2 &amp;gt; 30,
            "1 month to date - 2 months to date",
            IF (
                _2 &amp;lt;= 90
                    &amp;amp;&amp;amp; _2 &amp;gt; 60,
                "2 months to date - 3 months to date",
                "3 months to date +++"
            )
        )
    )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;column =
CALCULATE (
    SUM ( table[value] ),
    FILTER ( table, table[column] = EARLIER ( table[column] ) )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Rongtie&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Fri, 31 Mar 2023 02:23:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-03-31T02:23:16Z</dc:date>
    <item>
      <title>Creating calculated columns which show value from four different intervals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-calculated-columns-which-show-value-from-four-different/m-p/3160904#M113518</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create four columns that shows four different intervals:&lt;/P&gt;&lt;P&gt;Today - 1 month to date&lt;/P&gt;&lt;P&gt;1 month to date - 2 months to date&lt;/P&gt;&lt;P&gt;2 months to date - 3 months to date&lt;/P&gt;&lt;P&gt;3 months to date +++&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using a column which shows 'Due Date' to determine which column it should belong, and another column 'Amount (LCY)' that needs to be calculated based on the date intervals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried different types of DAX code, but I keep getting a lot of value in no man's land..&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 13:06:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-calculated-columns-which-show-value-from-four-different/m-p/3160904#M113518</guid>
      <dc:creator>MathiasBI</dc:creator>
      <dc:date>2023-03-29T13:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating calculated columns which show value from four different intervals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-calculated-columns-which-show-value-from-four-different/m-p/3164666#M113764</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="538299" data-lia-user-login="MathiasBI" class="lia-mention lia-mention-user"&gt;MathiasBI&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please have a try.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;column =
VAR _1 = table[date]
VAR _2 =
    DATEDIFF ( _1, TODAY (), DAY )
RETURN
    IF (
        _2 &amp;lt;= 30
            &amp;amp;&amp;amp; _2 &amp;gt;= 0 = 0,
        "Today - 1 month to date",
        IF (
            _2 &amp;lt;= 60
                &amp;amp;&amp;amp; _2 &amp;gt; 30,
            "1 month to date - 2 months to date",
            IF (
                _2 &amp;lt;= 90
                    &amp;amp;&amp;amp; _2 &amp;gt; 60,
                "2 months to date - 3 months to date",
                "3 months to date +++"
            )
        )
    )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;column =
CALCULATE (
    SUM ( table[value] ),
    FILTER ( table, table[column] = EARLIER ( table[column] ) )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Rongtie&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 02:23:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-calculated-columns-which-show-value-from-four-different/m-p/3164666#M113764</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-31T02:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating calculated columns which show value from four different intervals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-calculated-columns-which-show-value-from-four-different/m-p/3165683#M113847</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ended up creating variables for the past 1, 2 and 3 months, and equally for 1 month minus 1 day, 2 months minus 1 day etc.. like this:&lt;BR /&gt;Var 1m-1d&amp;nbsp;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;Date&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Year&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TODAY&lt;/SPAN&gt;&lt;SPAN&gt;()), &lt;/SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TODAY&lt;/SPAN&gt;&lt;SPAN&gt;()) - &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;Day&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TODAY&lt;/SPAN&gt;&lt;SPAN&gt;()-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then I used this formula to calculate the total amount that was due between two dates:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Due 1m-2m =&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;([Amount]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;DATESBETWEEN&lt;/SPAN&gt;&lt;SPAN&gt;([Due Date]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[2m before today]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[1m-1d after today]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 11:57:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-calculated-columns-which-show-value-from-four-different/m-p/3165683#M113847</guid>
      <dc:creator>MathiasBI</dc:creator>
      <dc:date>2023-03-31T11:57:47Z</dc:date>
    </item>
  </channel>
</rss>

