<?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 turn multiple SQL joins into DAX? Example challenge in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2296287#M56604</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;For calculating previous years values you can use SAMEPERIODLASTYEAR&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;[Sales LY]=&lt;BR /&gt;&lt;BR /&gt;CALCULATE([Sales],SAMEPERIODLASTYEAR('Calendar'[Date]))&lt;BR /&gt;&lt;BR /&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jan 2022 20:25:26 GMT</pubDate>
    <dc:creator>ValtteriN</dc:creator>
    <dc:date>2022-01-21T20:25:26Z</dc:date>
    <item>
      <title>How to turn multiple SQL joins into DAX? Example challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2296171#M56600</link>
      <description>&lt;P&gt;Help will be very much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say if I want to create a measure called "&lt;SPAN&gt;Prior_Sales", now I have two tables I can use -&amp;nbsp;[dim_date] and [sales].&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The result should be: given a particular ISO_Year_Week ("202219", meaning ISO Year 2022, week 19), I want to show the sales aggregated for ISO year 2011, week 19.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my SQL code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SELECT &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;iso_week,&lt;BR /&gt;c.iso_year_week,&lt;BR /&gt;Sum(sold_quantity) AS Prior_Sales&lt;BR /&gt;FROM [sales] a&lt;BR /&gt;JOIN &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(SELECT calendar_date, iso_year_week FROM [dim_date] WHERE current_fin_year = 'Previous') b&lt;BR /&gt;ON a.calendar_date = b.calendar_date&lt;BR /&gt;RIGHT JOIN &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(SELECT DISTINCT iso_week, iso_year_week FROM [dim_date] WHERE current_fin_year = 'current') c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-- using right join because ISO week are sometimes 52, sometimes 53&lt;BR /&gt;ON a.iso_week = c.iso_week&lt;BR /&gt;GROUP BY iso_week,&lt;BR /&gt;c.iso_year_week&lt;BR /&gt;ORDER BY 2 &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 19:07:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2296171#M56600</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-21T19:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn multiple SQL joins into DAX? Example challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2296287#M56604</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;For calculating previous years values you can use SAMEPERIODLASTYEAR&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;[Sales LY]=&lt;BR /&gt;&lt;BR /&gt;CALCULATE([Sales],SAMEPERIODLASTYEAR('Calendar'[Date]))&lt;BR /&gt;&lt;BR /&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 20:25:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2296287#M56604</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-01-21T20:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn multiple SQL joins into DAX? Example challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2296292#M56605</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response and this is a great formula to know!&lt;/P&gt;&lt;P&gt;The issue here is that the requirement is to look at the same "ISO Weeks", which are usually not the same dates and it's what complicates the problem.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 20:29:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2296292#M56605</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-21T20:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn multiple SQL joins into DAX? Example challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2296570#M56615</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;In the case of comparing weeks you could use variables.&lt;BR /&gt;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;SPAN&gt;Isoweeks[Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Isoweeks&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;Isoweeks[ISOWEEK]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;_LY_ISOWEEK&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Example data:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;img /&gt;&lt;P&gt;&lt;BR /&gt;End result:&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 22 Jan 2022 13:08:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2296570#M56615</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-01-22T13:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn multiple SQL joins into DAX? Example challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2299185#M56726</link>
      <description>&lt;P&gt;Hi Valterri, I just tried this formula and encountered a strange error prompt "an invalid numeric representation of a date value was encountered", do you happen to know what does it mean?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 17:56:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2299185#M56726</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-24T17:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn multiple SQL joins into DAX? Example challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2299189#M56728</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I would check whether or not you have NULL values and also what is the data format of your columns. These might be the reason for this error.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 17:59:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2299189#M56728</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-01-24T17:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn multiple SQL joins into DAX? Example challenge</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2299258#M56736</link>
      <description>&lt;P&gt;Hi, thank you again. I guess u r right there might be something with the original data. I don't see any null value or data type issue but when I reimported the original date data it was solved. Thank you very much again!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 19:17:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-turn-multiple-SQL-joins-into-DAX-Example-challenge/m-p/2299258#M56736</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-24T19:17:58Z</dc:date>
    </item>
  </channel>
</rss>

