<?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: Need help with a measure in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2014846#M31096</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/319182"&gt;@Radhika2605&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think this problem should be caused by your data model. Please check whether there are some products out of the "Store ID" list. Your calculate logic is that&amp;nbsp;&lt;SPAN&gt;[Total Stock On Hand] = 0 &amp;amp;&amp;amp; [Average Units Sold Legit] &amp;gt; 0 return&amp;nbsp;"Sale Lost", others return&amp;nbsp;&amp;nbsp;"No Loss". &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In Power BI,&amp;nbsp;the blank value will be recognized as 0. &lt;/SPAN&gt;&lt;SPAN&gt;So&amp;nbsp;&amp;nbsp;[Total Stock On Hand] = 0 &amp;amp;&amp;amp; [Average Units Sold Legit] = 0 will return&amp;nbsp;"No Loss" like result in your Screenshot.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here I will give you two advices.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. Result is all right, you can remove blank store ids in filter field.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 203px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/572523iF3C6E3193B7C0AFE/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. Update your measure code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Lost sale? =
IF (
    [Total Stock On Hand] = BLANK ()
        &amp;amp;&amp;amp; [Average Units Sold Legit] = BLANK (),
    BLANK (),
    IF (
        [Total Stock On Hand] = 0
            &amp;amp;&amp;amp; [Average Units Sold Legit] &amp;gt; 0,
        "Sale Lost",
        "No Loss"
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Aug 2021 08:10:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-08-13T08:10:13Z</dc:date>
    <item>
      <title>Need help with a measure</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2009803#M31040</link>
      <description>&lt;P&gt;I am trying to find out if any sale has been lost or not due to out of stock products and have created a measure for it but when I try to visualize this measure in a table then it first lists all the products without the store names and then all the stores and their relavant products come. In this table I have the following columns - Store Id, Store Name, Product Name, Average Units sold, Stock on hand, Inventory lasts for days and Lost sale measures as shown in the screenshot. First screenshot shows the table visual without lost sale measure and it is perfect but as soon as I bring the Lost sale measure then all the products get listed at the top and afterwards each store and their products come as shown in the second screenshot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Radhika2605_0-1628666709833.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/570863iE9E2C1319D1C915B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Radhika2605_0-1628666709833.png" alt="Radhika2605_0-1628666709833.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Radhika2605_1-1628666728265.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/570865iE0FF80F88E3CD10E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Radhika2605_1-1628666728265.png" alt="Radhika2605_1-1628666728265.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know this is due to context missing from the Lost Sale measure but I am unable to figure out how can I give the context. Can someone please help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measures used -&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Average Units Sold Legit = DIVIDE( [Total Units Sold], COUNTROWS( Dates ) ) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Inventory Lasts For (Days) = DIVIDE( [Total Stock On Hand], [Average Units Sold Legit] )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total Stock On Hand = SUM( Inventory[StockOnHand] )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Lost sale? = IF( [Total Stock On Hand] = 0 &amp;amp;&amp;amp; [Average Units Sold Legit] &amp;gt; 0, "Sale Lost", "No Loss")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;This is how my model looks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Radhika2605_2-1628666746603.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/570868iC806F32797486AB9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Radhika2605_2-1628666746603.png" alt="Radhika2605_2-1628666746603.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 11 Aug 2021 07:28:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2009803#M31040</guid>
      <dc:creator>Radhika2605</dc:creator>
      <dc:date>2021-08-11T07:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with a measure</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2014846#M31096</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/319182"&gt;@Radhika2605&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think this problem should be caused by your data model. Please check whether there are some products out of the "Store ID" list. Your calculate logic is that&amp;nbsp;&lt;SPAN&gt;[Total Stock On Hand] = 0 &amp;amp;&amp;amp; [Average Units Sold Legit] &amp;gt; 0 return&amp;nbsp;"Sale Lost", others return&amp;nbsp;&amp;nbsp;"No Loss". &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In Power BI,&amp;nbsp;the blank value will be recognized as 0. &lt;/SPAN&gt;&lt;SPAN&gt;So&amp;nbsp;&amp;nbsp;[Total Stock On Hand] = 0 &amp;amp;&amp;amp; [Average Units Sold Legit] = 0 will return&amp;nbsp;"No Loss" like result in your Screenshot.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here I will give you two advices.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. Result is all right, you can remove blank store ids in filter field.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 203px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/572523iF3C6E3193B7C0AFE/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. Update your measure code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Lost sale? =
IF (
    [Total Stock On Hand] = BLANK ()
        &amp;amp;&amp;amp; [Average Units Sold Legit] = BLANK (),
    BLANK (),
    IF (
        [Total Stock On Hand] = 0
            &amp;amp;&amp;amp; [Average Units Sold Legit] &amp;gt; 0,
        "Sale Lost",
        "No Loss"
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 08:10:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2014846#M31096</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-13T08:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with a measure</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2016872#M31130</link>
      <description>&lt;P&gt;Hi Rico,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks heaps for your response. You are an absolute genuis - both the solutions you mentioned worked. I have one question though - I was trying to find in which table this store id is blank but was not able to see any such record. Will it be possible for you to point out which table will it be? Thank again in advance.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Aug 2021 15:26:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2016872#M31130</guid>
      <dc:creator>Radhika2605</dc:creator>
      <dc:date>2021-08-15T15:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with a measure</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2017166#M31137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/319182"&gt;@Radhika2605&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Due to I don't know the details about your data model, I could only give you some advices.&lt;/P&gt;
&lt;P&gt;I think there should be a table have Product column and Store column. In this table, there shoule be&amp;nbsp;&lt;SPAN&gt;some products with Store ID which is out of the "Store ID" list.&amp;nbsp;Then you relate this table with other tables which have&amp;nbsp;Product column or Store column.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 02:04:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2017166#M31137</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-16T02:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with a measure</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2017771#M31149</link>
      <description>&lt;P&gt;Hi Rico,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your reply.&amp;nbsp; I will look into this one. thanks again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Radhika&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 07:01:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-help-with-a-measure/m-p/2017771#M31149</guid>
      <dc:creator>Radhika2605</dc:creator>
      <dc:date>2021-08-16T07:01:55Z</dc:date>
    </item>
  </channel>
</rss>

