<?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: Reporting on bundled product orders in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/863329#M7002</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="159166" data-lia-user-login="Nathaniel_C" class="lia-mention lia-mention-user"&gt;Nathaniel_C&lt;/a&gt;&amp;nbsp; thanks for the suggestions. I had (sorta) gotten this far also. Unfortunatley that will not always work. ProductA could be a component of more than 1 bundle sku and each bundle SKU could have a different quantity of ProductA.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below shows a snippet of the Bundle SKU table and the 2nd image a count of how many bundles each SKU is a component of.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;So it needs a second criteria identifying which SKU in the BundleSKU table to return the quantity of ComponentSku. For that criteria it needs to know which SKU, so needs a method to compare the SKUs in the invoice table for that invoice ID for a matching Sku in the BundleSKU table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like - lookupvalue(BundleSKUTable[Quantity],BundleSKUTable[SKU],Matches(A SKU in InvoiceID),BundleSKUTable[BundleSKU],InvoiceData[SKU])&lt;/P&gt;&lt;P&gt;Can we perform a loop (for/next) within a VAR DAX equation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Dec 2019 09:41:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-12-03T09:41:47Z</dc:date>
    <item>
      <title>Reporting on bundled product orders</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/862401#M6987</link>
      <description>&lt;P&gt;Good morning community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an existing report that shows quantity of product sold from an invoice table. We have started selling bundles of products eg 1 x ProductX, 2 x ProductY etc under a different SKU. I need the report to show quantites of the component SKUs and ignore the bundle SKU. Fortunately, for each invoiceID, our invoice table contains seperate records for the bundle sku AND the components BUT it shows 0 quantity for the components.&amp;nbsp;I have created a lookup table listing the Bundle SKU, the component SKU and quantity.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can easily create a column to check if the SKU on this record is listed as the SKU of a bundle. Where i am struggling, is figuring out how to identify if the SKU on the invoice record is part of a bundle.&lt;/P&gt;&lt;P&gt;An example of invoice data:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;InvoiceID&lt;/TD&gt;&lt;TD&gt;SKU&lt;/TD&gt;&lt;TD&gt;Quantity&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;BundleQA&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;ProductA&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;ProductB&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;An example of the lookup table&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Bundle SKU&lt;/TD&gt;&lt;TD&gt;ComponentSKU&lt;/TD&gt;&lt;TD&gt;Quantity&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;BundleQA&lt;/TD&gt;&lt;TD&gt;ProductA&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;BundleQA&lt;/TD&gt;&lt;TD&gt;ProductB&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;So what i am aiming to get, is a column - lets call it ReportQty - that will show 0 on the invoice record for&amp;nbsp;BundleQA, 3 for&amp;nbsp;ProductA and 2 for ProductB.&lt;/P&gt;&lt;P&gt;I am thinking i need something like matching SKUs in Invoice that ARE a bundle with a subset filtered table on invoice_sku = bundlelookup_componentSKU&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 15:54:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/862401#M6987</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-02T15:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting on bundled product orders</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/862534#M6991</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Not sure if I understand your question but try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Report Quantity =
LOOKUPVALUE ( Lookup[Quantity], Lookup[ComponentSKU], MAX ( InvoiceData[SKU] ) )&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 17:44:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/862534#M6991</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2019-12-02T17:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting on bundled product orders</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/862537#M6992</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Or with a zero:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Report Quantity =
IF (
    LOOKUPVALUE ( Lookup[Quantity], Lookup[ComponentSKU], MAX ( InvoiceData[SKU] ) )
        = BLANK (),
    0,
    LOOKUPVALUE ( Lookup[Quantity], Lookup[ComponentSKU], MAX ( InvoiceData[SKU] ) )
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 17:48:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/862537#M6992</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2019-12-02T17:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting on bundled product orders</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/862545#M6993</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;I was thinking that for each invoice, you may want to know the total of each of the components. So a measure to multiply the number of bundles by each of the components that make up that bundle.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Report Qty =
VAR _curInID =
    MAX ( InvoiceData[InvoiceID] )
VAR _maxQtyBundle =
    CALCULATE (
        MAX ( InvoiceData[Quantity] ),
        ALLEXCEPT ( InvoiceData, InvoiceData[InvoiceID] ),
        InvoiceData[Quantity] &amp;lt;&amp;gt; 0
    )
VAR _total =
    _maxQtyBundle
        * (
            IF (
                LOOKUPVALUE ( Lookup[Quantity], Lookup[ComponentSKU], MAX ( InvoiceData[SKU] ) )
                    = BLANK (),
                0,
                LOOKUPVALUE ( Lookup[Quantity], Lookup[ComponentSKU], MAX ( InvoiceData[SKU] ) )
            )
        )
RETURN
    _total&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 18:05:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/862545#M6993</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2019-12-02T18:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting on bundled product orders</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/863329#M7002</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="159166" data-lia-user-login="Nathaniel_C" class="lia-mention lia-mention-user"&gt;Nathaniel_C&lt;/a&gt;&amp;nbsp; thanks for the suggestions. I had (sorta) gotten this far also. Unfortunatley that will not always work. ProductA could be a component of more than 1 bundle sku and each bundle SKU could have a different quantity of ProductA.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below shows a snippet of the Bundle SKU table and the 2nd image a count of how many bundles each SKU is a component of.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;So it needs a second criteria identifying which SKU in the BundleSKU table to return the quantity of ComponentSku. For that criteria it needs to know which SKU, so needs a method to compare the SKUs in the invoice table for that invoice ID for a matching Sku in the BundleSKU table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like - lookupvalue(BundleSKUTable[Quantity],BundleSKUTable[SKU],Matches(A SKU in InvoiceID),BundleSKUTable[BundleSKU],InvoiceData[SKU])&lt;/P&gt;&lt;P&gt;Can we perform a loop (for/next) within a VAR DAX equation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 09:41:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/863329#M7002</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-03T09:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting on bundled product orders</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/863548#M7013</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="159166" data-lia-user-login="Nathaniel_C" class="lia-mention lia-mention-user"&gt;Nathaniel_C&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Looking at the construct of your formulae and thinking about how to return the bundleSKU value, led me to the following.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a calculated column (BundledSKU) that evaluates TRUE/FALSE if the invoice record SKU is a SKU in [Bundled SKU Matrix]. Then I can use that as a criteria in a Calculate(Firstnonblank()) to identify the relevant bundle sku name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can this be streamlined or is there a better way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;BundledQty = (LOOKUPVALUE('Bundled SKU Matrix'[Qty],'Bundled SKU Matrix'[SKU],CALCULATE(FIRSTNONBLANK(invoicedetails[SKU],TRUE()),filter(invoicedetails,invoicedetails[BundleSKU]=TRUE() &amp;amp;&amp;amp; invoicedetails[_invoiceid_value] = EARLIER(invoicedetails[_invoiceid_value]))),'Bundled SKU Matrix'[BundleSKU],invoicedetails[SKU])+0) * CALCULATE(FIRSTNONBLANK(invoicedetails[Quantity],TRUE()),filter(invoicedetails,invoicedetails[BundleSKU]=TRUE() &amp;amp;&amp;amp; invoicedetails[_invoiceid_value] = EARLIER(invoicedetails[_invoiceid_value])))+0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 12:22:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reporting-on-bundled-product-orders/m-p/863548#M7013</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-03T12:22:33Z</dc:date>
    </item>
  </channel>
</rss>

