<?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: Help with dax - product purchased during shelf life in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2052400#M46201</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Share the link from where i can download your PBI file.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Sep 2021 23:38:13 GMT</pubDate>
    <dc:creator>Ashish_Mathur</dc:creator>
    <dc:date>2021-09-01T23:38:13Z</dc:date>
    <item>
      <title>Help with dax - product purchased during shelf life</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2046856#M45990</link>
      <description>&lt;P&gt;Hello.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would have greatly appreciated if someone could help me with a dax formula for the following case:&lt;BR /&gt;I have a dimension table for product and a fact table for sales. Can also add that I have a standard calendar table, as it may be relevant here.&lt;BR /&gt;The products are food and have a shelf life. The different products have different shelf lives.&lt;/P&gt;&lt;P&gt;I would like to have a dax that calculates whether the different products are bought by the different customers during the products' shelf life. No need to consider how much, just whether it is purchased or not.&lt;/P&gt;&lt;P&gt;My next step is to calculate the number of customers bought divided by the number of customers, so that I have an index of the distribution of the various products. Below I have set up an example of the relevant tables:&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;&lt;P&gt;Best wishes&lt;/P&gt;&lt;P&gt;DJ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 17:56:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2046856#M45990</guid>
      <dc:creator>DJ1977</dc:creator>
      <dc:date>2021-08-30T17:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dax - product purchased during shelf life</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2047539#M46003</link>
      <description>&lt;P&gt;which date is the beginning of the shelf live?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 02:46:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2047539#M46003</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2021-08-31T02:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dax - product purchased during shelf life</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2047817#M46015</link>
      <description>&lt;P&gt;Hi and thanks for the reply.&lt;BR /&gt;Shelf life is the number of days the product lasts. That is no fixed date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find out if the customer has bought the product, based on today's date, and x number of days back. X here becomes shelf life for the product. So for productID 5176 i want to calculate if customer have bought the product within the last 22 days. (ref DimProduct table)&lt;/P&gt;&lt;P&gt;I have now found an expression that almost takes me where I want, but not quite, it is this:&lt;BR /&gt;----&lt;BR /&gt;Quantity Purchased Shelf life =&lt;BR /&gt;VAR Last_date = LASTDATE (FactSales [Date])&lt;/P&gt;&lt;P&gt;Return&lt;BR /&gt;CALCULATE (DISTINCTCOUNT (FactSales [CustomerID]),&lt;BR /&gt;FILTER (ALL (DimCalendar),&lt;BR /&gt;DimCalendar [Date]&amp;gt; Last_date - 20 &amp;amp;&amp;amp;&lt;BR /&gt;DimCalendar [Date] &amp;lt;= Last_date))&lt;BR /&gt;----&lt;BR /&gt;In this expression, "Last_date - 20" means that the shelf life is always 20 days. How can I replace 20 with an expression that uses the Product shelf life from the DimProduct table?&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;Do you see any solutions?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 07:46:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2047817#M46015</guid>
      <dc:creator>DJ1977</dc:creator>
      <dc:date>2021-09-01T07:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dax - product purchased during shelf life</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2050370#M46110</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="19851" data-lia-user-login="Ashish_Mathur" class="lia-mention lia-mention-user"&gt;Ashish_Mathur&lt;/a&gt;&amp;nbsp;Do you have any suggestion to how i can adjust my formula for my purpose?&lt;/P&gt;&lt;H3&gt;&amp;nbsp;&lt;/H3&gt;</description>
      <pubDate>Wed, 01 Sep 2021 05:50:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2050370#M46110</guid>
      <dc:creator>DJ1977</dc:creator>
      <dc:date>2021-09-01T05:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dax - product purchased during shelf life</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2051308#M46143</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Shouldn't you also have the date of manufacturing of each product?&amp;nbsp; Also, please clearly show the result you are expecting with an explanation.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 11:47:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2051308#M46143</guid>
      <dc:creator>Ashish_Mathur</dc:creator>
      <dc:date>2021-09-01T11:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dax - product purchased during shelf life</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2051526#M46160</link>
      <description>&lt;P&gt;Hi, and thanks for answering &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="19851" data-lia-user-login="Ashish_Mathur" class="lia-mention lia-mention-user"&gt;Ashish_Mathur&lt;/a&gt;&amp;nbsp;.&lt;BR /&gt;The case is perhaps a bit unclear, and would like to explain in more detail what I am looking for.&lt;BR /&gt;We have regular customers who are committed to maintaining a range of fresh products. These products have different shelf lives.&lt;BR /&gt;I want to know which customers have bought the products at least once during this shelf life. This is measured on the basis of today's date, and x days back, where x = shelf life.&lt;/P&gt;&lt;P&gt;Results should be displayed as a table, which shows the product, number of customers purchased during the shelf life, and an index. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Index = number of customers purchased during the shelf life / total number of customers. It's the counter in this fraction I'm struggling with. As previously explained, I have come close with the dax expression below:&lt;/P&gt;&lt;P&gt;Number of customers purchased shelf life =&lt;BR /&gt;VAR Last_date = LASTDATE (FactSales [Date])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Return&lt;BR /&gt;CALCULATE (DISTINCTCOUNT (FactSales [CustomerID]),&lt;BR /&gt;FILTER (ALL (DimCalendar),&lt;BR /&gt;DimCalendar [Date]&amp;gt; Last_date - 20 &amp;amp;&amp;amp;&lt;BR /&gt;DimCalendar [Date] &amp;lt;= Last_date))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this expression, "Last_date - 20" means that the shelf life is always 20 days. I am therefore wondering how I can make this dax expression so that it is dynamic in relation to the column Product shelf life from DimProduct table?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 13:47:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2051526#M46160</guid>
      <dc:creator>DJ1977</dc:creator>
      <dc:date>2021-09-01T13:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dax - product purchased during shelf life</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2052400#M46201</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Share the link from where i can download your PBI file.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 23:38:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2052400#M46201</guid>
      <dc:creator>Ashish_Mathur</dc:creator>
      <dc:date>2021-09-01T23:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dax - product purchased during shelf life</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2072535#M46900</link>
      <description>&lt;P&gt;Hello, i found a DAX that sorted this out for me. This is the solution to my question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quantity Purchased Shelf life =&lt;BR /&gt;VAR Last_date = TODAY()&lt;BR /&gt;VAR Shelf = SELECTEDVALUE(DimProduct[ProductShelflife])&lt;/P&gt;&lt;P&gt;Return&lt;BR /&gt;CALCULATE( DISTINCTCOUNT(FactSales[CustomerID]),&lt;BR /&gt;FILTER( ALL(DimCalendar),&lt;BR /&gt;DimCalendar[Date] &amp;gt; Last_date - Shelf &amp;amp;&amp;amp;&lt;BR /&gt;DimCalendar[Date] &amp;lt; Last_date))&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 10:07:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-dax-product-purchased-during-shelf-life/m-p/2072535#M46900</guid>
      <dc:creator>DJ1977</dc:creator>
      <dc:date>2021-09-13T10:07:59Z</dc:date>
    </item>
  </channel>
</rss>

