<?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: I need the cost to only appear for some products and not others in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-the-cost-to-only-appear-for-some-products-and-not-others/m-p/3207652#M116883</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299232" data-lia-user-login="BudMan512" class="lia-mention lia-mention-user"&gt;BudMan512&lt;/a&gt;&amp;nbsp;Try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ADJ COST 1 = 
  VAR __Category = MAX('Sales'[CATEGORY])
  VAR __First = LEFT(__Category, 1)
  VAR __Result = IF( __First = "L", [Avg Cost 1], BLANK())
RETURN
  __Result&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 26 Apr 2023 16:10:00 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2023-04-26T16:10:00Z</dc:date>
    <item>
      <title>I need the cost to only appear for some products and not others</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-the-cost-to-only-appear-for-some-products-and-not-others/m-p/3207544#M116863</link>
      <description>&lt;P&gt;I would appreciate your help with this.&lt;/P&gt;&lt;P&gt;Below is a screenshot of a report I am working on.&amp;nbsp; I only have the cost for products beginning with "L",&amp;nbsp; yet every product has the "Avg Cost 1" and "Avg Cost 2" populated with a value.&amp;nbsp; I would like any product beginning with some value other than "L" to be blank or have "0" if needed.&amp;nbsp; Avg Cost 1 and Avg Cost 2 are for different date ranges.&amp;nbsp; I have added the "ADJ COST 1" measure to try and limit where the cost shows.&amp;nbsp; Here is the latest iteration of DAX I have tried to accomplish my goal.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ADJ COST 1 = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Avg Cost 1]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;CONTAINSROW&lt;/SPAN&gt;&lt;SPAN&gt;( {&lt;/SPAN&gt;&lt;SPAN&gt;"L001"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"L002"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"L005"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"L007"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"L009"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"L013"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"L017"&lt;/SPAN&gt;&lt;SPAN&gt;},&lt;/SPAN&gt;&lt;SPAN&gt;Sales[CATEGORY]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But as you can see in the below screenshot all products still have a value for cost in the "ADJ COST 1" column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DAX I am using for Average Cost.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Avg Cost 1 = &lt;/SPAN&gt;&lt;SPAN&gt;AVERAGE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Cost[COST]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Avg Cost 2 = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;AVERAGE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Cost[COST]&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;Date1&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;USERELATIONSHIP&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Date1[Date1]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;Date2[Date2]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Could someone kindly assist in helping me with the DAX I need for the Avg Cost of both columns and only for products beginning with "L"? I have included screenshots of the report and model views.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks much,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Bud&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&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;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 14:53:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-the-cost-to-only-appear-for-some-products-and-not-others/m-p/3207544#M116863</guid>
      <dc:creator>BudMan512</dc:creator>
      <dc:date>2023-04-26T14:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: I need the cost to only appear for some products and not others</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-the-cost-to-only-appear-for-some-products-and-not-others/m-p/3207652#M116883</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299232" data-lia-user-login="BudMan512" class="lia-mention lia-mention-user"&gt;BudMan512&lt;/a&gt;&amp;nbsp;Try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ADJ COST 1 = 
  VAR __Category = MAX('Sales'[CATEGORY])
  VAR __First = LEFT(__Category, 1)
  VAR __Result = IF( __First = "L", [Avg Cost 1], BLANK())
RETURN
  __Result&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Apr 2023 16:10:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-the-cost-to-only-appear-for-some-products-and-not-others/m-p/3207652#M116883</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-04-26T16:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: I need the cost to only appear for some products and not others</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-the-cost-to-only-appear-for-some-products-and-not-others/m-p/3207890#M116912</link>
      <description>&lt;P&gt;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greg,&lt;/P&gt;&lt;P&gt;Thanks so much for taking the time to answer my post.&amp;nbsp; The solution worked perfectly.&amp;nbsp; In fact I was able to modify that measure for 8 other columns.&amp;nbsp; It cleaned up my report nicely.&lt;/P&gt;&lt;P&gt;I have two of your books and read them as I have time.&amp;nbsp; I am an old man (72) in a young mans game but still enjoy it for the most part except when I run into a problem like this. Thankfully there are people like you who are happy to help.&amp;nbsp; &amp;nbsp;Best Regards, Bud&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 19:49:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-the-cost-to-only-appear-for-some-products-and-not-others/m-p/3207890#M116912</guid>
      <dc:creator>BudMan512</dc:creator>
      <dc:date>2023-04-26T19:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: I need the cost to only appear for some products and not others</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-the-cost-to-only-appear-for-some-products-and-not-others/m-p/3207969#M116919</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299232" data-lia-user-login="BudMan512" class="lia-mention lia-mention-user"&gt;BudMan512&lt;/a&gt;&amp;nbsp;It's my pleasure!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 20:57:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-the-cost-to-only-appear-for-some-products-and-not-others/m-p/3207969#M116919</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-04-26T20:57:54Z</dc:date>
    </item>
  </channel>
</rss>

