<?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: How to add another Calculation for only fourth Quarter in this year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2705780#M82043</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wow! it works. Thank you so much&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2022 08:41:25 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-08-17T08:41:25Z</dc:date>
    <item>
      <title>How to add another Calculation for only fourth Quarter in this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2695029#M81282</link>
      <description>&lt;P&gt;I have 2 date tables,&lt;BR /&gt;1 for filtering and 2 for chart displaying as per below.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and as you can see the blank space in 2022 Q4, I need to calculate separately for only Q4. (forecast figure)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below are the measures I have tried, but I struck on combining the values (18.1) with the main measure. (Net sales)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The conditional for calculating Q4 is: Selected month of [Actual&amp;amp;Forecast] - (Q1 + Q2 + Q3)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my DAX formula for Net sales (Main measure):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Net sales = 
var var_EndOfYear = ENDOFYEAR(dDate[Date])
var LYtoTY = DATESINPERIOD(dDate_M[PeriodID],var_EndOfYear,-2,YEAR)
Var Estimation = [SelectedEstimation]
var ActualTY = 
CALCULATE(
    [ActualTY], 
    REMOVEFILTERS(dDate),
    KEEPFILTERS(LYtoTY),
    USERELATIONSHIP(dDate[Date],dDate_M[PeriodID]),
         FILTER(dDate_m,dDate_m[Month] &amp;lt;= [selectedmonth] &amp;amp;&amp;amp; dDate_m[Year] IN {[SelectedYear]})
         )

var ActualLY = 
CALCULATE(
    REMOVEFILTERS(dDate),
    KEEPFILTERS(LYtoTY),
    USERELATIONSHIP(dDate[Date],dDate_M[PeriodID]),
         FILTER(dDate_m,dDate_m[Year] IN {[SelectedYear] -1})
         )

var ForecastTY = 
CALCULATE(
    [ForecastTY],
    REMOVEFILTERS(dDate),
    KEEPFILTERS(LYtoTY),
    USERELATIONSHIP(dDate[Date],dDate_M[PeriodID]),
         FILTER(dDate_m,dDate_m[Month] &amp;gt; [SelectedMonth] &amp;amp;&amp;amp; dDate_m[Year] IN { [SelectedYear]} &amp;amp;&amp;amp; dDate_M[Quarter] &amp;lt;&amp;gt; 4)
         )

var sumActual = ActualTY + ActualLY + ForecastTY
return sumActual + "I have created another measure to combine here, but failed :("&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is Q4 DAX formula:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Net sales Q4 = 
var Estimation = [SelectedEstimation]
var Q123 =
        CALCULATE(
    [Actual],
    FILTER(all(ddate),dDate[Month] &amp;lt;= SELECTEDVALUE(dDate[Month]) &amp;amp;&amp;amp; dDate[Year] = SELECTEDVALUE(dDate[Year]) &amp;amp;&amp;amp; dDate[Quarter No.] &amp;lt;&amp;gt; 4)
    )
         + 
    CALCULATE(
    [Forecast],
    FILTER(all(ddate),dDate[Month] &amp;gt; SELECTEDVALUE(dDate[Month]) &amp;amp;&amp;amp; dDate[Year] = SELECTEDVALUE(dDate[Year])  &amp;amp;&amp;amp; dDate[Quarter No.] &amp;lt;&amp;gt; 4)
    )

var FY = 
    CALCULATE(
    [FYActual],
    FILTER(all(ddate),dDate[Month] &amp;lt; SELECTEDVALUE(dDate[Month]) &amp;amp;&amp;amp; dDate[Year] = SELECTEDVALUE(dDate[Year]))
    )
+
    CALCULATE(
    [FYForecast],
    FILTER(all(ddate),dDate[Month] &amp;gt;= SELECTEDVALUE(dDate[Month]) &amp;amp;&amp;amp; dDate[Year] = SELECTEDVALUE(dDate[Year]))
    )

var BarQ4 = FY - Q123

    return BarQ4&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some suggestions?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 11:15:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2695029#M81282</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-11T11:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another Calculation for only fourth Quarter in this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2698829#M81554</link>
      <description>&lt;P&gt;Please provide sanitized sample data that fully covers your issue. I can only help you with meaningful sample data.&lt;BR /&gt;Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive. Screenshots of your source data are not useful.&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 21:56:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2698829#M81554</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-08-13T21:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another Calculation for only fourth Quarter in this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2699695#M81646</link>
      <description>&lt;P&gt;My bad and thanks for your reply and suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the expected result in Q4 2022 (referring to the screenshot I attached) :&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Year&lt;/TD&gt;&lt;TD&gt;Quarter&lt;/TD&gt;&lt;TD&gt;Net sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;Q1&lt;/TD&gt;&lt;TD&gt;15.0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021&lt;/TD&gt;&lt;TD&gt;Q2&lt;/TD&gt;&lt;TD&gt;18.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021&lt;/TD&gt;&lt;TD&gt;Q3&lt;/TD&gt;&lt;TD&gt;18.6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021&lt;/TD&gt;&lt;TD&gt;Q4&lt;/TD&gt;&lt;TD&gt;26.9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2022&lt;/TD&gt;&lt;TD&gt;Q1&lt;/TD&gt;&lt;TD&gt;23.9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2022&lt;/TD&gt;&lt;TD&gt;Q2&lt;/TD&gt;&lt;TD&gt;24.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2022&lt;/TD&gt;&lt;TD&gt;Q3&lt;/TD&gt;&lt;TD&gt;22.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2022&lt;/TD&gt;&lt;TD&gt;Q4&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#00FF00"&gt;&lt;STRONG&gt;18.1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is the sample data (fact table) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Currency&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;TD&gt;ReportElement&lt;/TD&gt;&lt;TD&gt;DataLevel&lt;/TD&gt;&lt;TD&gt;OrganisationElementName&lt;/TD&gt;&lt;TD&gt;DateKey&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;EUR&lt;/TD&gt;&lt;TD&gt;2051.42&lt;/TD&gt;&lt;TD&gt;A&lt;/T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&gt;&lt;TD&gt;T&lt;/TD&gt;&lt;TD&gt;01-Dec-22&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 15 Aug 2022 05:25:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2699695#M81646</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-15T05:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another Calculation for only fourth Quarter in this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2701015#M81770</link>
      <description>&lt;P&gt;I don't think your sample data matches your expected output. Please verify, and also provide the forecast table.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 17:18:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2701015#M81770</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-08-15T17:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another Calculation for only fourth Quarter in this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2701684#M81802</link>
      <description>&lt;P&gt;I understand your point now.&lt;/P&gt;&lt;P&gt;Let me give you more context via this &lt;A href="https://thaiunion-my.sharepoint.com/:x:/p/adisanon_watthanabut/EYLYBqnIFZtLtRu5wwxhUZYBPUxZYgXYma8FLG37lWZR-Q?e=SmDhe7" target="_self"&gt;link (Excel)&lt;/A&gt;, it is included the issue explanation and covered of sample data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 03:22:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2701684#M81802</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-16T03:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another Calculation for only fourth Quarter in this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2705159#M82008</link>
      <description>&lt;P&gt;Hi&amp;nbsp; Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Net sales =
1&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Net sales Q4 = 2&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Flag1 =
SWITCH(
TRUE(),
MAX('Table'[Year])=2022&amp;amp;&amp;amp;MAX('Table'[QTR])="Q4",[Net sales Q4],
HASONEVALUE('Table'[Year])&amp;amp;&amp;amp;HASONEVALUE('Table'[QTR]),[Net sales])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Flag2 =
var _table=
SUMMARIZE('Table','Table'[QTR],"value",[Flag1])
return
IF(
HASONEVALUE('Table'[QTR]),[Flag1],SUMX(_table,[value]))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;all =
var _table=
SUMMARIZE('Table','Table'[Year],"value",[Flag2])
return
IF(
HASONEVALUE('Table'[Year]),[Flag2],SUMX(_table,[value]))&lt;/LI-CODE&gt;
&lt;P&gt;2.&amp;nbsp;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 06:09:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2705159#M82008</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-17T06:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another Calculation for only fourth Quarter in this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2705780#M82043</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wow! it works. Thank you so much&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 08:41:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-another-Calculation-for-only-fourth-Quarter-in-this/m-p/2705780#M82043</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-17T08:41:25Z</dc:date>
    </item>
  </channel>
</rss>

