<?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: Sum by a column, compare with threshold and count distinct in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-by-a-column-compare-with-threshold-and-count-distinct/m-p/3836032#M149983</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.&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;LI-CODE lang="markup"&gt;expected result measure: =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            ADDCOLUMNS (
                ADDCOLUMNS (
                    'Table',
                    "@tasksum",
                        CALCULATE (
                            SUM ( 'Table'[Knowledge] ),
                            FILTER ( 'Table', 'Table'[Task] = EARLIER ( 'Table'[Task] ) )
                        )
                ),
                "@condition",
                    SWITCH ( TRUE (), 'Table'[Team] = "Team 1", 1, 'Table'[Team] = "Team 2", 2 )
            ),
            'Table'[Task],
            [@tasksum],
            [@condition]
        ),
        [@tasksum] &amp;lt;= [@condition]
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Apr 2024 07:05:31 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2024-04-14T07:05:31Z</dc:date>
    <item>
      <title>Sum by a column, compare with threshold and count distinct</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-by-a-column-compare-with-threshold-and-count-distinct/m-p/3832792#M149875</link>
      <description>&lt;DIV&gt;&lt;P&gt;I try to create below measure, and need your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table is:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I want to create a measure which Sum Knowledge column Grouping by Task Column. After that compare if the sum of knowledge level is bigger than Team Knowlegde Threshold.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Them Knowledge Thresold is&lt;/P&gt;&lt;P&gt;1 for Team 1 and&lt;/P&gt;&lt;P&gt;2 for Team 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After comparing, Distinct count how many tasks are below the thresold.&lt;/P&gt;&lt;P&gt;So sum of Knowledge per Task for this example are&lt;/P&gt;&lt;P&gt;Task A = 2&lt;/P&gt;&lt;P&gt;Task B = 1&lt;/P&gt;&lt;P&gt;Task C = 3&lt;/P&gt;&lt;P&gt;Task D = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sum of 2 tasks are below the thresold.&lt;/P&gt;&lt;P&gt;Sum of Knowledge for Task B &amp;lt;= 1&lt;/P&gt;&lt;P&gt;Sum of Knowledge for Task D &amp;lt;= 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so the output of measure will be 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code, it works but the threshold is a constant and 2 . I couldnt manage to provide conditons above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UnderThethreshold =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT('Table'[Task]),&lt;BR /&gt;FILTER(&lt;BR /&gt;all('Table'[Task Name]),&lt;BR /&gt;CALCULATE(SUM('Table'[Knowledge]))&amp;lt;= 2&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 12 Apr 2024 06:57:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-by-a-column-compare-with-threshold-and-count-distinct/m-p/3832792#M149875</guid>
      <dc:creator>ismail95</dc:creator>
      <dc:date>2024-04-12T06:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sum by a column, compare with threshold and count distinct</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-by-a-column-compare-with-threshold-and-count-distinct/m-p/3836032#M149983</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.&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;LI-CODE lang="markup"&gt;expected result measure: =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            ADDCOLUMNS (
                ADDCOLUMNS (
                    'Table',
                    "@tasksum",
                        CALCULATE (
                            SUM ( 'Table'[Knowledge] ),
                            FILTER ( 'Table', 'Table'[Task] = EARLIER ( 'Table'[Task] ) )
                        )
                ),
                "@condition",
                    SWITCH ( TRUE (), 'Table'[Team] = "Team 1", 1, 'Table'[Team] = "Team 2", 2 )
            ),
            'Table'[Task],
            [@tasksum],
            [@condition]
        ),
        [@tasksum] &amp;lt;= [@condition]
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Apr 2024 07:05:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-by-a-column-compare-with-threshold-and-count-distinct/m-p/3836032#M149983</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-04-14T07:05:31Z</dc:date>
    </item>
  </channel>
</rss>

