<?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: Count nr of cases in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406868#M63237</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;New Measure =
SUMX ( VALUES ( Customers[Membership] ), [Old Measure] )&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 21 Mar 2022 14:20:40 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-03-21T14:20:40Z</dc:date>
    <item>
      <title>Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406757#M63230</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I'm quite new to Power Bi and need some help..&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have 2 tables. One table with service cases which shows the name of the case and the date.&amp;nbsp;&lt;BR /&gt;The other table contains name of the customer, og membership type and the From-and to-date based on the membership.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I want to know what kind of membership the person had when the Case was created.&amp;nbsp;&lt;BR /&gt;So it should count and filter based on the from/to-date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The sample pbix can be found here&lt;BR /&gt;&lt;A href="https://drive.google.com/file/d/1DcOF5cljdPW_S_uHDwLRCKf7VpDE9mMB/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1DcOF5cljdPW_S_uHDwLRCKf7VpDE9mMB/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PS: I did edit the PBIX.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The desired result should look like this:&lt;BR /&gt;Silver - 2&lt;BR /&gt;Gold - 1&lt;BR /&gt;&lt;BR /&gt;Since Johns Case A was when he was a Silver-member, and when case B occured he was a Gold Member.&amp;nbsp;&lt;BR /&gt;Alice is a Silver member.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This is what I get now:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 15:03:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406757#M63230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-21T15:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406868#M63237</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;New Measure =
SUMX ( VALUES ( Customers[Membership] ), [Old Measure] )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Mar 2022 14:20:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406868#M63237</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-21T14:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406891#M63239</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What is "Old Measure"?&lt;BR /&gt;I have no other measures in the attached pbix.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 14:31:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406891#M63239</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-21T14:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406929#M63244</link>
      <description>&lt;P&gt;[Count of Case name]&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 14:50:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406929#M63244</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-21T14:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406985#M63246</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&lt;BR /&gt;did it work with you or you still need help?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 15:12:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2406985#M63246</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-21T15:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2420592#M64107</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I still need help. Have you looked at the updated PBI? And the updated text?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 07:05:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2420592#M64107</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-28T07:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2420608#M64109</link>
      <description>&lt;P&gt;Not yet. I'll have a look and let you know&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 07:13:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2420608#M64109</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-28T07:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2420682#M64113</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please use this measure&lt;/P&gt;&lt;LI-CODE lang="php"&gt;Measure = 
SUMX ( 
    VALUES ( Tabell1[Membership] ),
    CALCULATE ( COUNTROWS ( Tabell2 ) )
)&lt;/LI-CODE&gt;&lt;P&gt;You can download the sample file with the solution&amp;nbsp;&lt;A href="https://www.dropbox.com/t/YwENCxv5dmbUvYOj" target="_blank"&gt;https://www.dropbox.com/t/YwENCxv5dmbUvYOj&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 07:32:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2420682#M64113</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-28T07:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2420891#M64124</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you for helping out, but this is still not correct. Looking at your solution and it still says&lt;BR /&gt;2 bronze&lt;BR /&gt;2 gold&lt;BR /&gt;3 silver.&lt;BR /&gt;&lt;BR /&gt;The total is correct, but the individual rows are not correct.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I was thinking if it is possible to have a formula which is something like:&lt;BR /&gt;If the date of the case is between the "from/to" columns, then it should count and return the value of the type of the membership. If it makes any sense..&lt;BR /&gt;I think I somehow need to look at the date of the case againt the From and To dates.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 08:44:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2420891#M64124</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-28T08:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2421009#M64135</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;What should be the correct count?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 09:18:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2421009#M64135</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-28T09:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2421303#M64157</link>
      <description>&lt;P&gt;The correct amount should be&lt;BR /&gt;Gold - 1 (case A). John was a Gold member when his Case A was registered.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Silver - 2 (Case B and C). John was a Silver member when his Case B was registered. Alice is a Silver member (and thats why she has no "to-date").&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 11:06:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2421303#M64157</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-28T11:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2425768#M64420</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Here the sample file with solution&amp;nbsp;&lt;A href="https://www.dropbox.com/t/Hv6SXT7RxExYumwA" target="_blank"&gt;https://www.dropbox.com/t/Hv6SXT7RxExYumwA&lt;/A&gt;&lt;BR /&gt;I started with creating a new calculated column to cover the gap in the open "Tabell1[To]" date with the last date in the "Tabell2[Date]" column&lt;/P&gt;&lt;LI-CODE lang="php"&gt;New To = 
IF ( 
    ISBLANK ( Tabell1[To] ),
    MAX ( Tabell2[Date] ),
    Tabell1[To]
)&lt;/LI-CODE&gt;&lt;P&gt;Then create a new table&lt;/P&gt;&lt;LI-CODE lang="php"&gt;Tabell3 = 
FILTER (
    CROSSJOIN ( 
        SELECTCOLUMNS ( Tabell1, "Name1", Tabell1[Name], "Membership", Tabell1[Membership], "From", Tabell1[From], "To", Tabell1[New To] ),
        SELECTCOLUMNS ( Tabell2, "Name2", Tabell2[Name], "Case Name", Tabell2[Case name], "Date", Tabell2[Date] )
    ),
    [Name1] = [Name2]
        &amp;amp;&amp;amp; [Date] &amp;gt;= [From]
            &amp;amp;&amp;amp; [Date] &amp;lt;= [To]
)&lt;/LI-CODE&gt;&lt;P&gt;The measure is simply&lt;/P&gt;&lt;LI-CODE lang="php"&gt;Measure = COUNTROWS ( Tabell3 )&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 03:59:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2425768#M64420</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-30T03:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count nr of cases</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2427134#M64494</link>
      <description>&lt;P&gt;The solutions look really good. Tried it on my actual dataset, and it's 95% accurate. I just have to do some tweaks. Thank you so much for the help!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 14:09:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-nr-of-cases/m-p/2427134#M64494</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-30T14:09:34Z</dc:date>
    </item>
  </channel>
</rss>

