<?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: Return a Count only if the person is an approver in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334548#M58744</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Any luck? Can tou please send sample data?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 12 Feb 2022 04:59:42 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-02-12T04:59:42Z</dc:date>
    <item>
      <title>Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2333820#M58703</link>
      <description>&lt;P&gt;I need help adjusting my dax code. I have a measure created to return the number of cardholders an approver oversees. The problem is that the measure is returning a count for cardholders who aren't approvers. This is an example of what my data looks like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have my data plugged into a nested table, but when you expand it all of the card holders under the approver are returning a count of 1.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My dax code for the count is:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;c Count of Card Members Overseen by Approver = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(table&lt;/SPAN&gt;&lt;SPAN&gt;[Card Holder]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 Feb 2022 15:44:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2333820#M58703</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-11T15:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334054#M58713</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you want it to return? To return for example 5 for all cardholders unde Gonzalez? Also any cardholder having more than one card or only one card per cardholder?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 17:38:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334054#M58713</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-11T17:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334178#M58721</link>
      <description>&lt;P&gt;Sorry for my unclear question. I want it to return the count of cardholders overseen. So in the example with Gonzalez, his count (5) is correct. However, all of the individuals under him are cardholders and not approvers. So I want them to show 0 rather than 1. Occasionally an approver and cardholder can be the same person so I need to also account for that.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 19:10:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334178#M58721</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-11T19:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334212#M58724</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Whatever your reason is you can try&lt;/P&gt;&lt;P&gt;Approver =&lt;BR /&gt;IF (&lt;BR /&gt;ISINSCOPE ( table[Approver] ),&lt;BR /&gt;COUNTROWS ( VALUES ( table[Card Holder] ) ),&lt;BR /&gt;0&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;but this will return all cardholder values to zero regardless whether they are also approvers or not. I'll let you know if I found a solution for that. First please try this code and let me know if it works.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 19:29:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334212#M58724</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-11T19:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334226#M58726</link>
      <description>&lt;P&gt;It still seems to be populating the 1's&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 19:36:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334226#M58726</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-11T19:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334268#M58728</link>
      <description>&lt;P&gt;I douot but worth trying&lt;BR /&gt;VAR CardCount =&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(table&lt;/SPAN&gt;&lt;SPAN&gt;[Card Holder]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;VAR Result =&lt;BR /&gt;IF (&amp;nbsp;&lt;SPAN&gt;CardCount=1, 0&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;SPAN&gt;CardCount)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Result&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 Feb 2022 20:09:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334268#M58728</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-11T20:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334548#M58744</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Any luck? Can tou please send sample data?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Feb 2022 04:59:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2334548#M58744</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-12T04:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2345144#M59296</link>
      <description>&lt;P&gt;That almost works. It returns a 0 for all cardholders, but occassionally there is a cardholder who is an approver.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 14:39:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2345144#M59296</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-17T14:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2345199#M59301</link>
      <description>&lt;P&gt;Under another approver?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 14:55:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2345199#M59301</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-17T14:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2345241#M59303</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Approver =
VAR CardCount =
    COUNTROWS ( VALUES ( table[Card Holder] ) )
VAR CardHolder =
    VALUES ( table[Card Holder] )
VAR Result =
    IF (
        CardCount = 1,
        IF ( CONTAINS ( table, table[Approver], CardHolder ), CardCount, 0 ),
        CardCount
    )
RETURN
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 17 Feb 2022 15:07:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2345241#M59303</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-17T15:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2352514#M59776</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you solved this problem? If so, kindly accept an appropriate reply as the solution or provide your own solution. If you are still confused about it, please provide some sample data or screenshot about the problem. Thanks.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Regards, &lt;BR /&gt;Community Support Team _ Jing&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 06:21:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2352514#M59776</guid>
      <dc:creator>v-jingzhang</dc:creator>
      <dc:date>2022-02-22T06:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Count only if the person is an approver</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2459598#M66500</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;I was going through open posts and noticed that for some reason I missed to reply to your last comment. I hope you already found a solution for this issue, if not please refer to the sample file with the solution.&amp;nbsp;&lt;A href="https://www.dropbox.com/t/JapcKP84iEDhZXx9" target="_blank" rel="noopener"&gt;https://www.dropbox.com/t/JapcKP84iEDhZXx9&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I don't know which number would you like to show next to the approver who is also a card holder therefore, I proposed two solutions hopefully&amp;nbsp;one of them will satisfy your requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="php"&gt;Count of Card Members Overseen by Approver 1 = 
VAR CardCount =
    COUNTROWS ( VALUES ( 'Table'[Card Holder] ) )
VAR CardHolder =
    ALL ( 'Table'[Approver] )
VAR Result =
    IF (
        CardCount = 1,
        IF ( SELECTEDVALUE ( 'Table'[Card Holder] ) IN CardHolder, 1, 0 ),
        CardCount
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;LI-CODE lang="php"&gt;Count of Card Members Overseen by Approver 2 = 
VAR CurrentCardHolder =
    SELECTEDVALUE ( 'Table'[Card Holder] )
VAR CardCount =
    COUNTROWS ( VALUES ( 'Table'[Card Holder] ) )
VAR CardApprovers =
    ALL ( 'Table'[Approver] )
VAR Result =
    IF (
        CardCount = 1,
        IF ( 
            CurrentCardHolder IN CardApprovers, 
            CALCULATE ( 
                COUNTROWS ( VALUES ( 'Table'[Card Holder] ) ), 
                'Table'[Approver] = CurrentCardHolder, 
                REMOVEFILTERS ( 'Table' ) 
            ), 
            0 
        ),
        CardCount
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2022 04:14:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Count-only-if-the-person-is-an-approver/m-p/2459598#M66500</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-16T04:14:24Z</dc:date>
    </item>
  </channel>
</rss>

