<?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 Count Values from two Fact tables with blanks in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Values-from-two-Fact-tables-with-blanks/m-p/2302904#M56921</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a star schema with 2 fact tables. I need two metrics from both tables in a &lt;STRONG&gt;new visual table&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;# Distinct Count From Call ID Fact1 table = DistinctCount(FACT1[CallID])&lt;/P&gt;&lt;P&gt;# Count of Strategies from FACT 2&lt;/P&gt;&lt;P&gt;The problem is that there are missing&amp;nbsp; strategies from table Fact2.&lt;/P&gt;&lt;P&gt;In the new visual table I need that Calls Id = null for # Count of Strategies metric when strategies don´t exists.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Can you help me with this?&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jan 2022 12:43:35 GMT</pubDate>
    <dc:creator>rmeng</dc:creator>
    <dc:date>2022-01-26T12:43:35Z</dc:date>
    <item>
      <title>Count Values from two Fact tables with blanks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Values-from-two-Fact-tables-with-blanks/m-p/2302904#M56921</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a star schema with 2 fact tables. I need two metrics from both tables in a &lt;STRONG&gt;new visual table&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;# Distinct Count From Call ID Fact1 table = DistinctCount(FACT1[CallID])&lt;/P&gt;&lt;P&gt;# Count of Strategies from FACT 2&lt;/P&gt;&lt;P&gt;The problem is that there are missing&amp;nbsp; strategies from table Fact2.&lt;/P&gt;&lt;P&gt;In the new visual table I need that Calls Id = null for # Count of Strategies metric when strategies don´t exists.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Can you help me with this?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 12:43:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Values-from-two-Fact-tables-with-blanks/m-p/2302904#M56921</guid>
      <dc:creator>rmeng</dc:creator>
      <dc:date>2022-01-26T12:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Count Values from two Fact tables with blanks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Values-from-two-Fact-tables-with-blanks/m-p/2303052#M56933</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="188484" data-lia-user-login="rmeng" class="lia-mention lia-mention-user"&gt;rmeng&lt;/a&gt;.&amp;nbsp;You could do something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Number of Strategies (FACT 2) = 
IF(
    ISBLANK(
        CALCULATE(
            COUNTROWS( 'Fact 2' ),
            TREATAS( VALUES( 'Fact 1'[Call ID] ), 'Fact 2'[Calls ID] )
        )
    ),
    "null",
    CALCULATE(
        COUNTROWS( 'Fact 2' ),
        TREATAS( VALUES( 'Fact 1'[Call ID] ), 'Fact 2'[Calls ID] )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I attached a .pbix file &lt;A href="https://stevehailey-my.sharepoint.com/:u:/g/personal/steve_stevehailey_onmicrosoft_com/EaratgSzRptGn1fP_Tpt8e4B5bSclszgkMFWjplqam9_Hg?e=bK4ANP" target="_self"&gt;here&lt;/A&gt;, in case it's helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 14:00:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Values-from-two-Fact-tables-with-blanks/m-p/2303052#M56933</guid>
      <dc:creator>SteveHailey</dc:creator>
      <dc:date>2022-01-26T14:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Count Values from two Fact tables with blanks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Values-from-two-Fact-tables-with-blanks/m-p/2312220#M57516</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="188484" data-lia-user-login="rmeng" class="lia-mention lia-mention-user"&gt;rmeng&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your screenshot, I think you couldn't make all relationships active or you will get a cycle in data model.&lt;/P&gt;
&lt;P&gt;For reference:&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-create-and-manage-relationships#adjusting-cross-filter-direction-for-a-complex-set-of-tables-and-relationships" target="_self"&gt;Manage relationship&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Here I choose to inactive "DIM Date"[Date] to "FACT 2"[Date].&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You just need to add Strategie column in it and use count function in values field. In your table visual, it will show blank if there is no strategie in Fact2.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Or create a easy measure to show null.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _Count = COUNT('FACT 2'[Strategie])
return
IF(ISBLANK(_Count),"null",_Count)&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Feb 2022 05:35:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Values-from-two-Fact-tables-with-blanks/m-p/2312220#M57516</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-01T05:35:52Z</dc:date>
    </item>
  </channel>
</rss>

