<?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: Optimization on Many to Many to Many in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1222255#M19843</link>
    <description>&lt;P&gt;Here's what you have to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Connect the ScenarioGroup table to Lane Masterdata as you have: ScenarioGroup[ScenarioGroup] 1 - * 'Lane Masterdata'[ScenarioGroup] where filtering is one-way from ScenarioGroup to 'Lane Masterdata'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Connect Lane Masterdata to Bids: Lane Masterdata[LaneID] * - * Bids[LaneID] where filtering is one-way from 'Lane Masterdata' to Bids. Hide 'Lane Masterdata' (that's the best thing to do). You should only see ScenarioGroup and Bids. In ScenarioGroup you should only see the columns: Group, Scenario. In Bids you should only see: LSP. All other columns should be hidden.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Create 3 measures. In Bids create [Total BID]&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Total BID = SUM( Bids[BID] )&lt;/LI-CODE&gt;&lt;P&gt;In ScenarioGroup create [Minimum Total BID]&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Minimum Total BID = 
var __shouldCalc =
    HASONEVALUE( ScenarioGroup[ScenarioGroup] )
var __result =
    if( __shouldCalc,
        MINX(
            ALLSELECTED( Bids[LSP] ),
            [Total BID]
        )
    )
return
    __result&lt;/LI-CODE&gt;&lt;P&gt;and [Minimum LSP]&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Minimum LSP = 
var __minTotalBid = [Minimum Total BID]
var __result =
    CONCATENATEX(
        FILTER(
            ALLSELECTED( Bids[LSP] ),
            [Total BID] = __minTotalBid
        ),
        Bids[LSP],
        ",",
        Bids[LSP],
        ASC
    )
return
    __result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, in your matrix, you can remove LSP from columns (leave the rest) and drop the measures in there. You'll see they do what you want. Also, you should have a slicer in the canvass for the LSP field. Play with it to see that the measures do indeed do what you wanted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jul 2020 17:07:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-07-14T17:07:27Z</dc:date>
    <item>
      <title>Optimization on Many to Many to Many</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1218771#M19751</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Lane Masterdata'&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Bids'&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Scenario_Group'&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data model is given above. The labels for the keys are identical by name, ie. 'Bids' and 'Lane Masterdata' is joined by 'Bids'[LaneID] and 'Lane Masterdata'[LaneID].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The challenge is, in literal non-dax terms: For each record 'Scenarios_Group', find all related records (LaneID's) in 'Lane Masterdata'. Then find the unique 'Bids'[LSP] where the sum of all 'Bids'[BID] is the minimum.&lt;/P&gt;&lt;P&gt;Ie. For each scenario, for each group, find the collective corresponding minimum bid among all the collective bids of the LSPs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have solved this easily by the use of M, but I would like a more dynamic solution, where my users can have the result dependent on their filter selection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anything unclear, please feel free to ask away.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Br,&lt;/P&gt;&lt;P&gt;Henrik&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything attached is a constructed example without meaningful reference.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 14:53:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1218771#M19751</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-13T14:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization on Many to Many to Many</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1219129#M19769</link>
      <description>It would be good if you could post the expected result... What one needs is the input data and then the output. I see the input data but would like to see the outcome as well.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Mon, 13 Jul 2020 17:23:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1219129#M19769</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-13T17:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization on Many to Many to Many</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1219236#M19775</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A sample output from 'Scenario_Group', two measures marked in green below,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And for your reference, please see the full "collective bids" list done in a matrix chart,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The corresponding desired output marked in yellow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps, or else please fire away.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 18:32:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1219236#M19775</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-13T18:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization on Many to Many to Many</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1222255#M19843</link>
      <description>&lt;P&gt;Here's what you have to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Connect the ScenarioGroup table to Lane Masterdata as you have: ScenarioGroup[ScenarioGroup] 1 - * 'Lane Masterdata'[ScenarioGroup] where filtering is one-way from ScenarioGroup to 'Lane Masterdata'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Connect Lane Masterdata to Bids: Lane Masterdata[LaneID] * - * Bids[LaneID] where filtering is one-way from 'Lane Masterdata' to Bids. Hide 'Lane Masterdata' (that's the best thing to do). You should only see ScenarioGroup and Bids. In ScenarioGroup you should only see the columns: Group, Scenario. In Bids you should only see: LSP. All other columns should be hidden.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Create 3 measures. In Bids create [Total BID]&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Total BID = SUM( Bids[BID] )&lt;/LI-CODE&gt;&lt;P&gt;In ScenarioGroup create [Minimum Total BID]&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Minimum Total BID = 
var __shouldCalc =
    HASONEVALUE( ScenarioGroup[ScenarioGroup] )
var __result =
    if( __shouldCalc,
        MINX(
            ALLSELECTED( Bids[LSP] ),
            [Total BID]
        )
    )
return
    __result&lt;/LI-CODE&gt;&lt;P&gt;and [Minimum LSP]&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Minimum LSP = 
var __minTotalBid = [Minimum Total BID]
var __result =
    CONCATENATEX(
        FILTER(
            ALLSELECTED( Bids[LSP] ),
            [Total BID] = __minTotalBid
        ),
        Bids[LSP],
        ",",
        Bids[LSP],
        ASC
    )
return
    __result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, in your matrix, you can remove LSP from columns (leave the rest) and drop the measures in there. You'll see they do what you want. Also, you should have a slicer in the canvass for the LSP field. Play with it to see that the measures do indeed do what you wanted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 17:07:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1222255#M19843</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-14T17:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization on Many to Many to Many</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1234967#M20195</link>
      <description>&lt;P&gt;Like, many thanks, this is awesome.. Would you care to venture an explanation of&amp;nbsp;&lt;SPAN&gt;[Minimum Total BID] and the use of &lt;/SPAN&gt;&amp;nbsp;ALLSELECTED within MINX?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 12:05:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1234967#M20195</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-20T12:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization on Many to Many to Many</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1237706#M20243</link>
      <description>&lt;P&gt;ALLSELECTED(...) is a function that gives you access to all the values (of a column) that your visual is currently operating on. It's used for purely visual calculations and a measure that uses it should never be used in a measure that contains an iterator. It's the most complex function in all DAX and should be used WITH UTMOST CARE (if you want to know more about its complexity, please read articles about it on &lt;A href="http://www.sqlbi.com" target="_blank" rel="noopener"&gt;www.sqlbi.com&lt;/A&gt;). Since you want to get the minimum of BIDs across all the visible BIDs in the current visual (not only the ones in the current context), you have to use this function.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 08:29:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimization-on-Many-to-Many-to-Many/m-p/1237706#M20243</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-21T08:29:32Z</dc:date>
    </item>
  </channel>
</rss>

