<?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 help in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help/m-p/4357941#M172998</link>
    <description>&lt;P&gt;Good day can anyone assist with the following dax measures for the following problem statement :&lt;BR /&gt;i have also attached a data sample, i would also like to create a calculated column to flag Preferred Customers from non preferred your assistance is highly appreciated&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Direct Revenue: Revenue generated when a customer purchases products from Product Group A, B, or C. Such customers will be classified as Preferred Customers.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Indirect Revenue: Revenue generated from purchases of other product groups by Preferred Customers who also buy from Product Group A, B, or C.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;|| || |Company Code|Fiscal Period|Product group|Ship-To Country|Customer|Base Unit of Measure|Quantity|NetSales| |5300|1|Product Group E|US|343663|EA|60.000 EA|48,384.00| |5300|1|Product Group E|US|10011981|EA|40.000 EA|2,000.00| |5300|1|Product Group E|US|10011981|#|0.000|(2,000.00)| |5300|1|Product Group E|US|10011981|EA|300.000 EA|7,500.00| |5300|1|Product group B|US|1590440|EA|1.000 EA|1,800.00| |5300|1|Product group B|US|1590380|EA|1.000 EA|3,500.00| |5300|1|Product group B|US|1590380|#|0.000|(3,500.00)| |5300|1|Product group B|US|923096|EA|1.000 EA|1,250.00| |5300|1|Product group B|US|923096|EA|1.000 EA|1,250.00| |5300|1|Product Group E|US|1716464|BIN|0.000 BIN|(333.50)| |5300|1|Product Group E|US|1716464|BIN|0.000 BIN|(280.60)| |5300|1|Product Group E|US|10002731|EA|48.000 EA|172.80| |5300|1|Product Group E|US|10002731|#|0.000|(172.80)| |5300|1|Product Group E|US|10002731|EA|48.000 EA|2,400.00| |5300|1|Product Group E|US|1582108|EA|0.000 EA|3,500.00| |5300|1|Product Group E|US|10012387|BIN|-680.000 BIN|(2,210.00)|&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jan 2025 23:48:55 GMT</pubDate>
    <dc:creator>gomorasa</dc:creator>
    <dc:date>2025-01-09T23:48:55Z</dc:date>
    <item>
      <title>Dax help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help/m-p/4357941#M172998</link>
      <description>&lt;P&gt;Good day can anyone assist with the following dax measures for the following problem statement :&lt;BR /&gt;i have also attached a data sample, i would also like to create a calculated column to flag Preferred Customers from non preferred your assistance is highly appreciated&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Direct Revenue: Revenue generated when a customer purchases products from Product Group A, B, or C. Such customers will be classified as Preferred Customers.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Indirect Revenue: Revenue generated from purchases of other product groups by Preferred Customers who also buy from Product Group A, B, or C.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;|| || |Company Code|Fiscal Period|Product group|Ship-To Country|Customer|Base Unit of Measure|Quantity|NetSales| |5300|1|Product Group E|US|343663|EA|60.000 EA|48,384.00| |5300|1|Product Group E|US|10011981|EA|40.000 EA|2,000.00| |5300|1|Product Group E|US|10011981|#|0.000|(2,000.00)| |5300|1|Product Group E|US|10011981|EA|300.000 EA|7,500.00| |5300|1|Product group B|US|1590440|EA|1.000 EA|1,800.00| |5300|1|Product group B|US|1590380|EA|1.000 EA|3,500.00| |5300|1|Product group B|US|1590380|#|0.000|(3,500.00)| |5300|1|Product group B|US|923096|EA|1.000 EA|1,250.00| |5300|1|Product group B|US|923096|EA|1.000 EA|1,250.00| |5300|1|Product Group E|US|1716464|BIN|0.000 BIN|(333.50)| |5300|1|Product Group E|US|1716464|BIN|0.000 BIN|(280.60)| |5300|1|Product Group E|US|10002731|EA|48.000 EA|172.80| |5300|1|Product Group E|US|10002731|#|0.000|(172.80)| |5300|1|Product Group E|US|10002731|EA|48.000 EA|2,400.00| |5300|1|Product Group E|US|1582108|EA|0.000 EA|3,500.00| |5300|1|Product Group E|US|10012387|BIN|-680.000 BIN|(2,210.00)|&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 23:48:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help/m-p/4357941#M172998</guid>
      <dc:creator>gomorasa</dc:creator>
      <dc:date>2025-01-09T23:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dax help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help/m-p/4358049#M173004</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="910720" data-lia-user-login="gomorasa" class="lia-mention lia-mention-user"&gt;gomorasa&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;create a blank query. open the advanced editor. copy and paste the code below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("rZPLbsIwEEV/xUo3VHKj8SOOsyyIVl0UUVFWiEUEbhsJYpQ4C/6+kyBDQIg2aRdxri3rzJ2HF4tgZLe7NN+TkV2bgAZPWblKN2RqisyucT8t7LpaOfJZ2GqH+9lXtnt4t3i9yl2xx5NRVTq7NQXKYVoaMs8zR+wHeTVpWRU1861Kc5e5+vLEuFm6MSXKYEkXQSQAULNWpOc6EhnjyXyGi5BCKYFi/IiLghAASKOlpkLLsAH8EsYAGEs08zjZwnGKsi/tDr+Ghf+BJ933Nyag5Sym0U/OmvaQ4REXJSAleBo7sRjVPVhCX2OJXr4OrLOCedCtgl2QEi4gUVcT5FE3U39BXbYxZkoqWT+Fl4nPkBz0QAgRRp2G4haNawhVxxEDHovT7OtWpjEPdbfJ96yzRh44/2SKU9n1QUaaM9AeBp1G9cqL5ELHx+o/KH3eAIqxjkO7/AY=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t, Column7 = _t, Column8 = _t, Column9 = _t]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"NetSales", type number}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "(Non/)Preferred Customer Flag", each if Text.Contains([Product group],"A") and [NetSales] &amp;gt;0 or 
Text.Contains([Product group],"B") and [NetSales] &amp;gt;0 or 
Text.Contains([Product group],"C")  and [NetSales] &amp;gt;0 then "Preferred Customers"
else "Non Preferred")
in
    #"Added Custom"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the flag is based on the logic below. if sales &amp;gt; 0 and prod groups contain A , B or C , then preferred else not preferred.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if this isn't the required logic, kindly elaborate and provide a sample output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 02:25:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help/m-p/4358049#M173004</guid>
      <dc:creator>adudani</dc:creator>
      <dc:date>2025-01-10T02:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dax help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help/m-p/4358269#M173018</link>
      <description>&lt;P&gt;Thanks for the reply from adudani&amp;nbsp;, please allow me to provide another insight:&amp;nbsp; &lt;BR /&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="910720" data-lia-user-login="gomorasa" class="lia-mention lia-mention-user"&gt;gomorasa&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Test =
var _COUNTABC=
CALCULATE(
    DISTINCTCOUNT([Product group]),FILTER(ALL('Table'),[Customer]=EARLIER([Customer])&amp;amp;&amp;amp;[Product group] in {"Product group A","Product group B","Product group C"}))
var _COUNTOTHER=
CALCULATE(
    DISTINCTCOUNT([Product group]),FILTER(ALL('Table'),[Customer]=EARLIER([Customer])&amp;amp;&amp;amp;NOT([Product group]) in {"Product group A","Product group B","Product group C"}))
RETURN
SWITCH(
    TRUE(),
    _COUNTABC&amp;gt;=1&amp;amp;&amp;amp;_COUNTOTHER=BLANK(),"Direct Revenue",
    _COUNTABC&amp;gt;=1&amp;amp;&amp;amp;_COUNTOTHER&amp;gt;=1,"Indirect Revenue")&lt;/LI-CODE&gt;
&lt;P&gt;2. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 06:26:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help/m-p/4358269#M173018</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-01-10T06:26:19Z</dc:date>
    </item>
  </channel>
</rss>

