<?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: Create a measure using another measure to filter by year.. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1318119#M23162</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="172151" data-lia-user-login="sharpedogs" class="lia-mention lia-mention-user"&gt;sharpedogs&lt;/a&gt; , You can measure like this &lt;/P&gt;
&lt;P&gt;Total = Sumx(Table,[RRSP Contribution]+ [TFSA Contribution]+ [Equity contributions]&lt;BR /&gt;or&lt;BR /&gt;Total = Sum(Table[RRSP Contribution])+ Sum(Table[TFSA Contribution])+ Sum(Table[Equity contributions])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The use of time intelligence&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;YTD = CALCULATE([Total]),DATESYTD('Date'[Date],"12/31"))
Last YTD = CALCULATE([Total],DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year = CALCULATE([Total],DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last to last YTD = CALCULATE([Total],DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind = CALCULATE([Total],dateadd('Date'[Date],-1,Year))
//Only year vs Year, not a level below

This Year = CALCULATE([Total],filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE([Total],filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
Last to Last Year = CALCULATE([Total],filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-2))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Power BI — YTD &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2020 = CALCULATE([Total], filter(all(Table[Date]), Year(Table[Date]) = 2020))&lt;BR /&gt;2019 = CALCULATE([Total], filter(all(Table[Date]), Year(Table[Date]) = 2019))&lt;/P&gt;</description>
    <pubDate>Mon, 24 Aug 2020 04:40:18 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2020-08-24T04:40:18Z</dc:date>
    <item>
      <title>Create a measure using another measure to filter by year..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316516#M23128</link>
      <description>&lt;P&gt;I have multiple columns that represent month over month invenstments. I want to sum up multiple columns and create a measures to put in a card so that it shows total investments for that year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a measure "Total Contributions" which is simply a sum of all my contributions. Now I want to take my "Total contribution" measure and create a new measure so I can put it in a card to show three seperate data points&lt;/P&gt;&lt;P&gt;1) Total Contributions 2018&lt;/P&gt;&lt;P&gt;2) Total Contributions 2019&lt;/P&gt;&lt;P&gt;3) Total Contributions 2020&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;Dates&lt;/TD&gt;&lt;TD&gt;RRSP Contribution&lt;/TD&gt;&lt;TD&gt;TFSA Contribution&lt;/TD&gt;&lt;TD&gt;Equity contributions&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;jan 1 2018&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;10,000&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Feb 4 2018&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Dec 1 2019&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Oct 3 2020&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;TD&gt;7000&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 17:35:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316516#M23128</guid>
      <dc:creator>sharpedogs</dc:creator>
      <dc:date>2020-08-22T17:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create a measure using another measure to filter by year..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316534#M23129</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="172151" data-lia-user-login="sharpedogs" class="lia-mention lia-mention-user"&gt;sharpedogs&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a Calendar Table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Refer :&lt;BR /&gt;&lt;A href="https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions" target="_blank"&gt;https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi" target="_blank"&gt;https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create the relationship between dates of Calendar Table and Date of Contribution Table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now drag the year column from the Calendar Table into the visualization pane and the&amp;nbsp;&amp;nbsp;column RRSP Contribution, TFSA Contribution, Equity contributions from your Contribution Table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Incase you want a Total sum of these three Columns&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Total Contribution = SUMX('Table', 'Table'[Equity contributions] + 'Table'[RRSP Contribution] + 'Table'[TFSA Contribution])&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Regards,&lt;BR /&gt;Harsh Nathani&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to drag&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 18:19:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316534#M23129</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-22T18:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create a measure using another measure to filter by year..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316547#M23130</link>
      <description>&lt;P&gt;Hi Harsh,&lt;/P&gt;&lt;P&gt;That output is good for a column driven visual. I want to put the single value in card, I would prefer to do it using measure instead of filter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A Measure where I would sum total investments then filter by year 2019...&amp;nbsp; I can't seem to get the syntext correct.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 20:04:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316547#M23130</guid>
      <dc:creator>sharpedogs</dc:creator>
      <dc:date>2020-08-22T20:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Create a measure using another measure to filter by year..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316612#M23131</link>
      <description>&lt;P&gt;Please try this expression to get your result (replace Table with your actual table name).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Total Contributions 2019 = CALCULATE([Total Contributions], FILTER(ALLSELECTED(Table[Dates]), YEAR(Table[Dates])=2019))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you could just put your [Total Contributions] measure in the card, and add a visual level filter in the Filter Panel on the Dates column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this works for you, please mark it as the solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 21:49:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316612#M23131</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-08-22T21:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create a measure using another measure to filter by year..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316627#M23134</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="172151" data-lia-user-login="sharpedogs" class="lia-mention lia-mention-user"&gt;sharpedogs&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total Contribution 2018 = CALCULATE([Total Contribution], Filter(Dates, YEAR(Dates[Date]) = 2018))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total Contribution 2019 = CALCULATE([Total Contribution], Filter(Dates, YEAR(Dates[Date]) = 2019))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total Contribution 2020 = CALCULATE([Total Contribution], Filter(Dates, YEAR(Dates[Date]) = 2020))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Harsh Nathani&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 22:10:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1316627#M23134</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-22T22:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create a measure using another measure to filter by year..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1318119#M23162</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="172151" data-lia-user-login="sharpedogs" class="lia-mention lia-mention-user"&gt;sharpedogs&lt;/a&gt; , You can measure like this &lt;/P&gt;
&lt;P&gt;Total = Sumx(Table,[RRSP Contribution]+ [TFSA Contribution]+ [Equity contributions]&lt;BR /&gt;or&lt;BR /&gt;Total = Sum(Table[RRSP Contribution])+ Sum(Table[TFSA Contribution])+ Sum(Table[Equity contributions])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The use of time intelligence&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;YTD = CALCULATE([Total]),DATESYTD('Date'[Date],"12/31"))
Last YTD = CALCULATE([Total],DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year = CALCULATE([Total],DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last to last YTD = CALCULATE([Total],DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind = CALCULATE([Total],dateadd('Date'[Date],-1,Year))
//Only year vs Year, not a level below

This Year = CALCULATE([Total],filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE([Total],filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
Last to Last Year = CALCULATE([Total],filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-2))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Power BI — YTD &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2020 = CALCULATE([Total], filter(all(Table[Date]), Year(Table[Date]) = 2020))&lt;BR /&gt;2019 = CALCULATE([Total], filter(all(Table[Date]), Year(Table[Date]) = 2019))&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 04:40:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1318119#M23162</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-08-24T04:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create a measure using another measure to filter by year..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1318700#M23171</link>
      <description>&lt;P&gt;&lt;FONT&gt;To program such things in accordance with the Power BI philosophy (which means "do things seamlessly, fast and reliable"), you should unpivot your table first. So, your table should have columns: Date, Contribution Type, Contribution Value. This can be done in Power Query easily. Contribution Type would contain 3 values: RRSP, TFSA and Equity. So, you need table T like this:&lt;/FONT&gt;&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;Date&lt;/TD&gt;&lt;TD&gt;Contribution Type&lt;/TD&gt;&lt;TD&gt;Contribution Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-01-01&lt;/TD&gt;&lt;TD&gt;RRSP&lt;/TD&gt;&lt;TD&gt;10000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;2018-01-01&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;TFSA&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;2018-01-01&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;Equity&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you have it, the rest is dead easy. Your main measure would be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Total = SUM( T[Contribution Value] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now you create a Dates table that covers all full years in terms of days and connect its [Date] field to the [Date] field in the above table. You hide [Contribution Value] and [Date] in T. You only leave [Contribution Type] exposed as you'll be slicing by it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, if you put a slicer on the canvas that shows only the years from the Date table (which should be marked as the date table in the model) and start slicing by it, the above measure will adjust accordingly. If you make a slicer out of [Contribution Type], you'll also be able to see the individual contributions from individual types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to hard-code a value like [Total Contribution in Year XXXX] (which will not change according to selections), you can write:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[Total Contribution in Year XXXX] =
var __year = XXXX
return
calculate(
    [Total Contribution],
    Dates[Year] = __year,
    ALL( T )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If, however, you want your measure to change according to all selections but the ones made in the Dates, you can write:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[Total Contribution in Year XXXX] =
var __year = XXXX
return
calculate(
    [Total Contribution],
    Dates[Year] = __year,
    ALL( Dates )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 08:30:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-using-another-measure-to-filter-by-year/m-p/1318700#M23171</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-24T08:30:31Z</dc:date>
    </item>
  </channel>
</rss>

