<?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 First DAX attempt not working - 12m back. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-DAX-attempt-not-working-12m-back/m-p/3199156#M157075</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I'm trying to create a visualisation that goes back 12 months from the selected date in a slicer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm working off this video -&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=d8Rm7dwM6gc" target="_blank"&gt;https://www.youtube.com/watch?v=d8Rm7dwM6gc&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My Code so far is:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TRI P12M = 
VAR ReferenceDate = MAX ( 'Date'[Date] )
VAR PreviousDates = 
    DATESINPERIOD (
        'Previous Date'[Date],
        ReferenceDate,
        -12,
        MONTH
    )
VAR Result =
    CALCULATE(
        MAX(
        'DataFreqRates'[TRI Month]),
        PreviousDates,
        USERELATIONSHIP ( 'Date'[Date], 'Previous Date'[Date])
    )
RETURN
     Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can follow what the video is saying and what it is trying to do, but I am getting an error -&amp;nbsp;&lt;I&gt;MdxScript(Model) (18, 5) Calculation error in measure 'DataFreqRates'[TRI P12M]: an invalid numeric representation of a date value was encountered.&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Which I &lt;STRONG&gt;think&lt;/STRONG&gt; is saying I am trying to sum a date, but I'm not sure how or why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suspect its cause I'm only new to DAX and am missing something basic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;More Info -&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TRI Month is basically a performance metric for the end of the month.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DataFreqRates is the table that calculates several scores.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can someone point me in the right direction?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Apr 2023 01:58:31 GMT</pubDate>
    <dc:creator>CityZ3n</dc:creator>
    <dc:date>2023-04-21T01:58:31Z</dc:date>
    <item>
      <title>First DAX attempt not working - 12m back.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-DAX-attempt-not-working-12m-back/m-p/3199156#M157075</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I'm trying to create a visualisation that goes back 12 months from the selected date in a slicer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm working off this video -&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=d8Rm7dwM6gc" target="_blank"&gt;https://www.youtube.com/watch?v=d8Rm7dwM6gc&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My Code so far is:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TRI P12M = 
VAR ReferenceDate = MAX ( 'Date'[Date] )
VAR PreviousDates = 
    DATESINPERIOD (
        'Previous Date'[Date],
        ReferenceDate,
        -12,
        MONTH
    )
VAR Result =
    CALCULATE(
        MAX(
        'DataFreqRates'[TRI Month]),
        PreviousDates,
        USERELATIONSHIP ( 'Date'[Date], 'Previous Date'[Date])
    )
RETURN
     Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can follow what the video is saying and what it is trying to do, but I am getting an error -&amp;nbsp;&lt;I&gt;MdxScript(Model) (18, 5) Calculation error in measure 'DataFreqRates'[TRI P12M]: an invalid numeric representation of a date value was encountered.&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Which I &lt;STRONG&gt;think&lt;/STRONG&gt; is saying I am trying to sum a date, but I'm not sure how or why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suspect its cause I'm only new to DAX and am missing something basic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;More Info -&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TRI Month is basically a performance metric for the end of the month.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DataFreqRates is the table that calculates several scores.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can someone point me in the right direction?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 01:58:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-DAX-attempt-not-working-12m-back/m-p/3199156#M157075</guid>
      <dc:creator>CityZ3n</dc:creator>
      <dc:date>2023-04-21T01:58:31Z</dc:date>
    </item>
  </channel>
</rss>

