<?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 DAX or Measures and Columns? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-or-Measures-and-Columns/m-p/1388942#M25417</link>
    <description>&lt;P&gt;Hey experts, I'm a newbie to PBI.&lt;/P&gt;&lt;P&gt;I have a table in PBI Desktop which I have imported from Database view.( &lt;EM&gt;this view is a result of multipe dimensions and facts join&lt;/EM&gt;)&lt;/P&gt;&lt;P&gt;Now I have a complex SQL query having multiple aggregations and group by on multiple columns. The resulted attributes help me built my report.&lt;/P&gt;&lt;P&gt;A mocked up query is provided below, I'm looking for help around implementing this, Should I create derivation logic for each column in Power Query by using Calculated columns or Measures? Or can I write one big DAX function(create table using SUMMARIZE/ADD COLUMNS/GROUP BY) which can result in a table with all the required columns and data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SELECT&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_date.CalenderDate,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_Fund.Fund_Cd,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CASE &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN D_Currency.Currency_Code = "Dollar" THEN "United States of America"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN D_Currency.Currency_Code = "Pound" THEN "United Kingdom"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN&amp;nbsp;D_Currency.Currency_Code = "Dollar" and D_Currency.Country_Code = "CAN" THEN "Canada"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ELSE "Others" as Actual_Country,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SUM ( D_Currency.Amount) as Total_Amt,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SUM ( D_Fund.Fund_Price) as Fund_Total,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(Total_Amt + Fund_Total) as Gross_Amt&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Source_View_imported&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHERE&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_fund.Fund_System_Cd =1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AND D_Date.Validate = CAST("2020/09/10" as date)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;GROUP BY&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_date.CalenderDate,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_Fund.Fund_Cd,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CASE&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN D_Currency.Currency_Code = "Dollar" THEN "United States of America"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN D_Currency.Currency_Code = "Pound" THEN "United Kingdom"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN&amp;nbsp;D_Currency.Currency_Code = "Dollar" and D_Currency.Country_Code = "CAN" THEN "Canada"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ELSE "Others" as Actual_Country&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 9 such queries to be created with different logics and then I will have to join them, so one step solution/DAX or anything will help.&lt;/P&gt;&lt;P&gt;Thanks a lot for your time in reading this and helping out. Cheers&lt;/P&gt;&lt;P&gt;Ton of thanks to all those who have been helping tremendously and fast pacing our learning experience, special thansk to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;/&lt;SPAN&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;your solutions have helped big time for over a month now.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Sep 2020 03:02:40 GMT</pubDate>
    <dc:creator>payyadi</dc:creator>
    <dc:date>2020-09-23T03:02:40Z</dc:date>
    <item>
      <title>DAX or Measures and Columns?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-or-Measures-and-Columns/m-p/1388942#M25417</link>
      <description>&lt;P&gt;Hey experts, I'm a newbie to PBI.&lt;/P&gt;&lt;P&gt;I have a table in PBI Desktop which I have imported from Database view.( &lt;EM&gt;this view is a result of multipe dimensions and facts join&lt;/EM&gt;)&lt;/P&gt;&lt;P&gt;Now I have a complex SQL query having multiple aggregations and group by on multiple columns. The resulted attributes help me built my report.&lt;/P&gt;&lt;P&gt;A mocked up query is provided below, I'm looking for help around implementing this, Should I create derivation logic for each column in Power Query by using Calculated columns or Measures? Or can I write one big DAX function(create table using SUMMARIZE/ADD COLUMNS/GROUP BY) which can result in a table with all the required columns and data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SELECT&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_date.CalenderDate,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_Fund.Fund_Cd,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CASE &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN D_Currency.Currency_Code = "Dollar" THEN "United States of America"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN D_Currency.Currency_Code = "Pound" THEN "United Kingdom"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN&amp;nbsp;D_Currency.Currency_Code = "Dollar" and D_Currency.Country_Code = "CAN" THEN "Canada"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ELSE "Others" as Actual_Country,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SUM ( D_Currency.Amount) as Total_Amt,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SUM ( D_Fund.Fund_Price) as Fund_Total,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(Total_Amt + Fund_Total) as Gross_Amt&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Source_View_imported&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHERE&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_fund.Fund_System_Cd =1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AND D_Date.Validate = CAST("2020/09/10" as date)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;GROUP BY&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_date.CalenderDate,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;D_Fund.Fund_Cd,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CASE&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN D_Currency.Currency_Code = "Dollar" THEN "United States of America"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN D_Currency.Currency_Code = "Pound" THEN "United Kingdom"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;WHEN&amp;nbsp;D_Currency.Currency_Code = "Dollar" and D_Currency.Country_Code = "CAN" THEN "Canada"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ELSE "Others" as Actual_Country&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 9 such queries to be created with different logics and then I will have to join them, so one step solution/DAX or anything will help.&lt;/P&gt;&lt;P&gt;Thanks a lot for your time in reading this and helping out. Cheers&lt;/P&gt;&lt;P&gt;Ton of thanks to all those who have been helping tremendously and fast pacing our learning experience, special thansk to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;/&lt;SPAN&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;your solutions have helped big time for over a month now.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 03:02:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-or-Measures-and-Columns/m-p/1388942#M25417</guid>
      <dc:creator>payyadi</dc:creator>
      <dc:date>2020-09-23T03:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: DAX or Measures and Columns?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-or-Measures-and-Columns/m-p/1389016#M25418</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255372" data-lia-user-login="payyadi" class="lia-mention lia-mention-user"&gt;payyadi&lt;/a&gt; , You need to have a new column like &lt;/P&gt;
&lt;P&gt;Actual_Country = &lt;BR /&gt;Switch ( True() ,&lt;BR /&gt;[Currency_Code] = "Dollar" &amp;amp;&amp;amp; [Country_Code] = "CAN" , "Canada",&lt;BR /&gt;[Currency_Code] = "Dollar" , "United States of America"&lt;BR /&gt;[Currency_Code] = "Pound" , "United Kingdom"&lt;BR /&gt;, "Others" )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other like &lt;EM&gt;Amount&lt;/EM&gt;, &lt;EM&gt;Fund_Price&lt;/EM&gt; just take Sum as aggregation in visualization&lt;/P&gt;
&lt;P&gt;these two you case use in slicer or measures filter&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;D_fund.Fund_System_Cd =1&lt;BR /&gt;D_Date.Validate&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Refer if my Dax vs SQL series can help: &lt;A href="https://www.youtube.com/watch?v=WlvQ_SGy4iA&amp;amp;list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj" target="_blank"&gt;https://www.youtube.com/watch?v=WlvQ_SGy4iA&amp;amp;list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 03:30:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-or-Measures-and-Columns/m-p/1389016#M25418</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-23T03:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: DAX or Measures and Columns?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-or-Measures-and-Columns/m-p/1390312#M25472</link>
      <description>&lt;P&gt;Hi Amit, Thanks for your quick response. I'm in for your solution but how should I refer back the same column I just created? Like if you see my sample query I reuse the just created columns,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Total_Amt + ...) as Gross_Amt&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;even if I want to reuse Actual_Currency as a condition for deriving a new column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 13:32:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-or-Measures-and-Columns/m-p/1390312#M25472</guid>
      <dc:creator>payyadi</dc:creator>
      <dc:date>2020-09-23T13:32:57Z</dc:date>
    </item>
  </channel>
</rss>

