<?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 in one to many relationship in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2593663#M74783</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="388770" data-lia-user-login="melvin9900" class="lia-mention lia-mention-user"&gt;melvin9900&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please try this code:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;rank =
VAR _c =
    COUNTROWS (
        FILTER ( ALLSELECTED ( SalesDetails ), [Product] = "A1" || [Product] = "B1" )
    )
RETURN
    IF (
        ISBLANK ( MAX ( 'SalesDetails'[Rank] ) ),
        IF ( SELECTEDVALUE ( Products[Product Name] ) = "C1" &amp;amp;&amp;amp; _c &amp;gt; 0, 1, "N/A" ),
        MAX ( 'SalesDetails'[Rank] )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2022 03:14:18 GMT</pubDate>
    <dc:creator>v-chenwuz-msft</dc:creator>
    <dc:date>2022-06-22T03:14:18Z</dc:date>
    <item>
      <title>Need help in one to many relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2584006#M74246</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I am new to DAX world, so any help is much appreciated.&lt;/P&gt;&lt;P&gt;Workin on a Salesreport , that has two slicer Salesperson and Month.&lt;/P&gt;&lt;P&gt;I have to display a table with Products and rank for the selected Salesperson and month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Source data : Tabular Model&lt;/P&gt;&lt;P&gt;Table 1 : Products&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Table 2:&amp;nbsp; SalesPerson&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Table 3 : SalesDetails&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;img /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on the Selection of Salesperson and Month , the report should display all the Products and their corresponding rank from SalesDetails table .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Conditions :&amp;nbsp; 1.&amp;nbsp; Should display all Products and if the Product rank doesnt exist in the SalesDetails table then it should display it as N/A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 . If a Salesperson/Month combination doesnt have any rank for the Product C1&amp;nbsp; but have Rank for the other Products then C1 rank should be defaulted to 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example : For the Salesperson = Ben and Month = 2/1/2022&lt;/P&gt;&lt;P&gt;Expected output :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;For the Salesperson = Ben and Month = 3/1/2022.&lt;/P&gt;&lt;P&gt;Even though C1 rank is not in the SalesDetails table but it has rank for the other Products so the C1 should be defaulted to 1.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Same with&amp;nbsp;Salesperson = Jon/King and Month = 3/1/2022&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;For the Salesperson = Les/Wes and Month = 2/1/2022 . No data available so all should be 'N/A'&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;The tabular model has many to 1 relationship with filter on both sides between the table SalesDetails and Product. But the report table shows only the Products that are present in the Salesdetails table for that Salesperson and month combination.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Ben it shows only A1, B1&amp;nbsp; and C1 for the month&amp;nbsp;2/1/2022.&lt;/P&gt;&lt;P&gt;So I need help to show all the product names in the table and display 'N/A' if that doesnt exist in the SalesDetails table.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 20:09:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2584006#M74246</guid>
      <dc:creator>melvin9900</dc:creator>
      <dc:date>2022-06-16T20:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in one to many relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2584315#M74268</link>
      <description>&lt;P&gt;Use Product Name in table 1&amp;nbsp;instead product in table 3&lt;/P&gt;&lt;P&gt;Make the relationship cross filter diretion "BOTH"&lt;/P&gt;&lt;P&gt;Right click on&amp;nbsp;Product Name, click show items with no data.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 01:44:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2584315#M74268</guid>
      <dc:creator>vapid128</dc:creator>
      <dc:date>2022-06-17T01:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in one to many relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2591902#M74684</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="388770" data-lia-user-login="melvin9900" class="lia-mention lia-mention-user"&gt;melvin9900&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please use the field from&amp;nbsp;dimensional tables (&amp;nbsp;&lt;SPAN&gt;Products ) in the table visual.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;power bi automatically hides rows with empty results, so that more attention can be paid to the items with data. You can turn off the function as &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="359999" data-lia-user-login="vapid128" class="lia-mention lia-mention-user"&gt;vapid128&lt;/a&gt;&amp;nbsp;said. Or you can defind the result by youself via measure.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Measure refer the following:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;rank =
IF (
    ISBLANK ( MAX ( 'SalesDetails'[Rank] ) ),
    "N/A",
    MAX ( 'SalesDetails'[Rank] )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 09:49:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2591902#M74684</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-06-21T09:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in one to many relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2592840#M74736</link>
      <description>&lt;P&gt;Thank you for the Solution. The condition 1 works fine and need some help on the Condition 2 below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Conditions :&amp;nbsp; 1.&amp;nbsp; Should display all Products and if the Product rank doesnt exist in the SalesDetails table then it should display it as N/A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 . If a Salesperson/Month combination doesnt have any rank for the Product C1&amp;nbsp; but have Rank for the product (A1 or B1 ) then C1 rank should be defaulted to 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your sameple report , for the selected filters C1 should be 1 because the product A1 or B1 is not N/A.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 16:35:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2592840#M74736</guid>
      <dc:creator>melvin9900</dc:creator>
      <dc:date>2022-06-21T16:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in one to many relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2593663#M74783</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="388770" data-lia-user-login="melvin9900" class="lia-mention lia-mention-user"&gt;melvin9900&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please try this code:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;rank =
VAR _c =
    COUNTROWS (
        FILTER ( ALLSELECTED ( SalesDetails ), [Product] = "A1" || [Product] = "B1" )
    )
RETURN
    IF (
        ISBLANK ( MAX ( 'SalesDetails'[Rank] ) ),
        IF ( SELECTEDVALUE ( Products[Product Name] ) = "C1" &amp;amp;&amp;amp; _c &amp;gt; 0, 1, "N/A" ),
        MAX ( 'SalesDetails'[Rank] )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 03:14:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-one-to-many-relationship/m-p/2593663#M74783</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-06-22T03:14:18Z</dc:date>
    </item>
  </channel>
</rss>

