<?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: How to map intentional many-to-many relationship &amp;amp; double count some values on purpose? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Help-How-to-map-intentional-many-to-many-relationship-amp/m-p/4338107#M172253</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with data and am struggling to return the output I intend, due to the presence of many-to-many relationships between my data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of a mapping table I have, noting that there are multiple values (India&amp;nbsp;&lt;EM&gt;and&lt;/EM&gt; Singapore) against an OD Country value of AustraliaSingapore:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Route&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Origin Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Destination Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;OD Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;AustraliaJapan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;AustraliaSingapore&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;SingaporeIndia&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;AustraliaSingapore&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Here is an example of my data, with "Route" hypothetically matched in on OD Country::&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Record #&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Origin Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Destination Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;OD Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Seats&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Route&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;AustraliaJapan&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;IndiaSingapore&lt;/TD&gt;&lt;TD&gt;70&lt;/TD&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;AustraliaSingapore&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Singapore;India&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;However,&amp;nbsp; "Route" &lt;EM&gt;cannot&lt;/EM&gt; be mapped in, because it maps to both Singapore and India. Annoyingly, I do infact want it to map against both of these conditions. Here is the output I want:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Route&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Seats&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I am aware that this double counts Record # 3 as both "India" and "Singapore", but this is actually the result I am after.&lt;BR /&gt;Is there a DAX calculation I can make to force this to work this way?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Bonus question:&amp;nbsp;&lt;/STRONG&gt;What I&amp;nbsp;&lt;EM&gt;really&lt;/EM&gt; want to achieve with this data is to take the minimum value between two defined city pairs. So in this example, I want the minimum value between&amp;nbsp;&lt;EM&gt;either&amp;nbsp;&lt;/EM&gt;AustraliaSingapore&amp;nbsp;&lt;EM&gt;or&lt;/EM&gt;&amp;nbsp;IndiaSingapore; this is becuase the data deals with connecting flights, where the restraining factor is the flight with the minimum number of seats. I would then need to build this logic out across a large whitelist of city pairs, with anything not on the list just equalling its stated value.&lt;BR /&gt;&lt;BR /&gt;In this case, the expected output would be:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Route&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Seats&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I understand this is a huge longshot but any help would be TREMENDOUSLY appreciated -- this logic has been driving me absolutely crazy!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
    <pubDate>Fri, 20 Dec 2024 06:56:04 GMT</pubDate>
    <dc:creator>PBI12345</dc:creator>
    <dc:date>2024-12-20T06:56:04Z</dc:date>
    <item>
      <title>DAX Help: How to map intentional many-to-many relationship &amp; double count some values on purpose?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Help-How-to-map-intentional-many-to-many-relationship-amp/m-p/4338107#M172253</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with data and am struggling to return the output I intend, due to the presence of many-to-many relationships between my data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of a mapping table I have, noting that there are multiple values (India&amp;nbsp;&lt;EM&gt;and&lt;/EM&gt; Singapore) against an OD Country value of AustraliaSingapore:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Route&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Origin Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Destination Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;OD Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;AustraliaJapan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;AustraliaSingapore&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;SingaporeIndia&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;AustraliaSingapore&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Here is an example of my data, with "Route" hypothetically matched in on OD Country::&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Record #&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Origin Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Destination Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;OD Country&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Seats&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Route&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;AustraliaJapan&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;IndiaSingapore&lt;/TD&gt;&lt;TD&gt;70&lt;/TD&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;AustraliaSingapore&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Singapore;India&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;However,&amp;nbsp; "Route" &lt;EM&gt;cannot&lt;/EM&gt; be mapped in, because it maps to both Singapore and India. Annoyingly, I do infact want it to map against both of these conditions. Here is the output I want:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Route&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Seats&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I am aware that this double counts Record # 3 as both "India" and "Singapore", but this is actually the result I am after.&lt;BR /&gt;Is there a DAX calculation I can make to force this to work this way?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Bonus question:&amp;nbsp;&lt;/STRONG&gt;What I&amp;nbsp;&lt;EM&gt;really&lt;/EM&gt; want to achieve with this data is to take the minimum value between two defined city pairs. So in this example, I want the minimum value between&amp;nbsp;&lt;EM&gt;either&amp;nbsp;&lt;/EM&gt;AustraliaSingapore&amp;nbsp;&lt;EM&gt;or&lt;/EM&gt;&amp;nbsp;IndiaSingapore; this is becuase the data deals with connecting flights, where the restraining factor is the flight with the minimum number of seats. I would then need to build this logic out across a large whitelist of city pairs, with anything not on the list just equalling its stated value.&lt;BR /&gt;&lt;BR /&gt;In this case, the expected output would be:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Route&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Seats&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I understand this is a huge longshot but any help would be TREMENDOUSLY appreciated -- this logic has been driving me absolutely crazy!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 06:56:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Help-How-to-map-intentional-many-to-many-relationship-amp/m-p/4338107#M172253</guid>
      <dc:creator>PBI12345</dc:creator>
      <dc:date>2024-12-20T06:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Help: How to map intentional many-to-many relationship &amp; double count some values on purpose?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Help-How-to-map-intentional-many-to-many-relationship-amp/m-p/4338517#M172271</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405068" data-lia-user-login="PBI12345" class="lia-mention lia-mention-user"&gt;PBI12345&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try the below steps:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Step 1&lt;/STRONG&gt;: Double Counting Records&lt;/P&gt;&lt;P&gt;To achieve the result where a record is counted for both mapped "Route" values, you can use a calculated table to "flatten" the mappings in your data. This ensures each OD Country splits into multiple rows for each valid route.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Solution: Create a Calculated Table for Mapping&lt;/P&gt;&lt;P&gt;In Power BI, create a calculated table using DAX to expand the Route mappings for your OD Country.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ExpandedRoutes = 
ADDCOLUMNS(
    GENERATE(
        'MappingTable',
        VAR RoutesList = SUBSTITUTE('MappingTable'[Route], ";", ",")
        RETURN SELECTCOLUMNS(
            SPLIT(RoutesList, ","),
            "Route", TRIM([Value])
        )
    ),
    "OD Country", 'MappingTable'[OD Country]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This table will:&lt;/P&gt;&lt;P&gt;Split Route on ; into separate rows.&lt;/P&gt;&lt;P&gt;Add a new row for each route in the original mapping.&lt;/P&gt;&lt;P&gt;Example output for ExpandedRoutes:&lt;/P&gt;&lt;P&gt;Route OD Country&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;AustraliaJapan&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;AustraliaSingapore&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;AustraliaSingapore&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Step 2:&lt;/STRONG&gt; Map Records to Routes&lt;/P&gt;&lt;P&gt;Once the mappings are expanded, we can create a new calculated table or measure to aggregate the Seats by Route.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure for Aggregation&lt;/P&gt;&lt;P&gt;Create a measure to calculate the total seats by each route:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Seats = 
CALCULATE(
    SUM('Data'[Seats]),
    TREATAS('ExpandedRoutes'[OD Country], 'Data'[OD Country]),
    TREATAS('ExpandedRoutes'[Route], 'MappingTable'[Route])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The TREATAS function ensures that OD Country and Route relationships are used for context filtering. The measure will give you the double-counted seat values:&lt;/P&gt;&lt;P&gt;Route Seats&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Step 3: &lt;/STRONG&gt;Minimum Seats Between City Pairs&lt;/H3&gt;&lt;P&gt;For your bonus requirement, you want to calculate the minimum value between city pairs for connecting flights. This requires additional logic to evaluate and filter data.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Whitelist of City Pairs&lt;/STRONG&gt;&lt;BR /&gt;Create a table for the whitelist of city pairs in Power BI:&lt;/P&gt;&lt;P&gt;City Pair&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;AustraliaSingapore&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;IndiaSingapore&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Measure for Minimum Seats&lt;/STRONG&gt;&lt;BR /&gt;Use the following measure to calculate the minimum value between city pairs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Min Seats = 
VAR WhitelistPairs = VALUES('Whitelist'[City Pair])
RETURN
SUMX(
    DISTINCT('ExpandedRoutes'[Route]),
    MINX(
        FILTER(
            'Data',
            'Data'[OD Country] IN WhitelistPairs
                &amp;amp;&amp;amp; 'Data'[Route] = 'ExpandedRoutes'[Route]
        ),
        'Data'[Seats]
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This measure:&lt;/P&gt;&lt;P&gt;Iterates over each route.&lt;/P&gt;&lt;P&gt;Filters the data for city pairs in the whitelist.&lt;/P&gt;&lt;P&gt;Takes the minimum Seats value for each pair.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Final Output&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Route Seats&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Japan&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Singapore&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this should handle both your requirements effectively. Let me know if you need clarification or further adjustments!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution, this will help others!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If my response(s) assisted you in any way, don't forget to drop me a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Poojara&lt;BR /&gt;Data Analyst | MSBI Developer | Power BI Consultant&lt;BR /&gt;&lt;STRONG&gt;Consider Subscribing my YouTube for Beginners/Advance Concepts:&lt;/STRONG&gt;&amp;nbsp;&lt;A href="https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS" target="_self"&gt;https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 10:48:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Help-How-to-map-intentional-many-to-many-relationship-amp/m-p/4338517#M172271</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2024-12-20T10:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Help: How to map intentional many-to-many relationship &amp; double count some values on purpose?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Help-How-to-map-intentional-many-to-many-relationship-amp/m-p/4338691#M172281</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405068" data-lia-user-login="PBI12345" class="lia-mention lia-mention-user"&gt;PBI12345&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Split the "Route" values in the "OD Country" column into individual country values.&lt;/P&gt;&lt;P&gt;Measure:&lt;/P&gt;&lt;PRE&gt;Route Seats = &lt;BR /&gt;SUMX(&lt;BR /&gt;FILTER(&lt;BR /&gt;'YourDataTable', &lt;BR /&gt;CONTAINSSTRING('YourDataTable'[OD Country], 'YourMappingTable'[OD Country])&lt;BR /&gt;),&lt;BR /&gt;'YourDataTable'[Seats]&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;First, create a mapping table for the city pairs:&lt;/P&gt;&lt;P&gt;Origin Country&amp;nbsp; &amp;nbsp; &amp;nbsp;Destination Country&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Minimum Seats&lt;BR /&gt;Australia&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Singapore&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(min seats)&lt;BR /&gt;India&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Singapore&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(min seats)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, use a DAX formula to find the minimum value:&lt;/P&gt;&lt;PRE&gt;Min Seats = &lt;BR /&gt;MINX(&lt;BR /&gt;FILTER(&lt;BR /&gt;'YourDataTable', &lt;BR /&gt;'YourDataTable'[Route] IN VALUES('YourMappingTable'[OD Country])&lt;BR /&gt;), &lt;BR /&gt;'YourDataTable'[Seats]&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":love_letter:"&gt;💌&lt;/span&gt; &lt;STRONG&gt;If this helped, a Kudos &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; or Solution mark &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; would be great! &lt;span class="lia-unicode-emoji" title=":party_popper:"&gt;🎉&lt;/span&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Cheers,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Kedar&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;A href="https://www.linkedin.com/in/kedar-pande" target="_blank" rel="noopener"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 12:41:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Help-How-to-map-intentional-many-to-many-relationship-amp/m-p/4338691#M172281</guid>
      <dc:creator>Kedar_Pande</dc:creator>
      <dc:date>2024-12-20T12:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Help: How to map intentional many-to-many relationship &amp; double count some values on purpose?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Help-How-to-map-intentional-many-to-many-relationship-amp/m-p/4338871#M172292</link>
      <description>&lt;P&gt;Hi Poojara,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the detailed this response. I have read the steps and this sounds like it will work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I cannot get past your step 1 -- specifically, 'SPLIT' is not showing up as a valid DAX function and the whole piece of code errors. Am I doing something wrong?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 14:37:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Help-How-to-map-intentional-many-to-many-relationship-amp/m-p/4338871#M172292</guid>
      <dc:creator>PBI12345</dc:creator>
      <dc:date>2024-12-20T14:37:01Z</dc:date>
    </item>
  </channel>
</rss>

