<?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: URGENT!! Get Sum of rows by grouping based on column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3750109#M146275</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp; ,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for giving us a specific DAX code and a detailed description of the problem. Based on your description, it seems like you want to calculate the sum of each category in the column df_Brands [Category Purchased], considering specific criteria. Here's a revised version of the DAX formula that should meet the requirements:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SUMX(
    VALUES(df_Brands[Category Purchased]), 
    VAR CurrentCategory = df_Brands[Category Purchased]
    VAR OccasionsYes = CALCULATE(COUNTROWS('df_Occasions'), 'df_Occasions'[value1] = "Yes", 'df_Brands'[Category Purchased] = CurrentCategory)
    VAR CategoryYes = CALCULATE(COUNTROWS('df_Category Purchased'), 'df_Category Purchased'[value] = "Yes", 'df_Brands'[Category Purchased] = CurrentCategory)
    RETURN
        IF(
            OccasionsYes &amp;gt; 0 &amp;amp;&amp;amp;
            CategoryYes &amp;gt; 0 &amp;amp;&amp;amp;
            (
                COUNTROWS(FILTER(Respondent, Respondent[IsBrands] = TRUE() &amp;amp;&amp;amp; Respondent[Category Purchased] = CurrentCategory)) &amp;gt; 0 
            ),
            1,
            0
        )
)
&lt;/LI-CODE&gt;
&lt;P&gt;If you have any challenges or other issues implementing this solution, can you share the specific data ( including table and model ) you have used in text and image format? This will help diagnose the problem more effectively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Caroline Mei&lt;BR /&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2024 02:10:08 GMT</pubDate>
    <dc:creator>v-yanimei-msft</dc:creator>
    <dc:date>2024-03-08T02:10:08Z</dc:date>
    <item>
      <title>URGENT!! Get Sum of rows by grouping based on column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3749018#M146223</link>
      <description>&lt;P&gt;Hello, Power Bi community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need some help with the below code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you modify this dax code such that every df_Brands[Category Purchased] value, gives me a different Total Sum, So in simple words it groups by the count rows of the df_Brands table based on the df_Brands[Category Purchased] column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TotalSum_CategoryOccasions_MultiSelect_Part2 demo = 
CALCULATE(
    SUMX(
        VALUES(Respondent[Unique_ID]),
        VAR OccasionsYes = CALCULATE(COUNTROWS('df_Occasions'), 'df_Occasions'[value1] = "Yes")
        VAR CategoryYes = CALCULATE(COUNTROWS('df_Category Purchased'), 'df_Category Purchased'[value] = "Yes")
        RETURN
            IF(
                OccasionsYes &amp;gt; 0 &amp;amp;&amp;amp;
                CategoryYes &amp;gt; 0 &amp;amp;&amp;amp;
                (
                    COUNTROWS(FILTER(Respondent, Respondent[IsBrands] = TRUE())) &amp;gt; 0 
                ),
                1,
                0
            )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/14361" target="_blank"&gt;@MFelix&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;,&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/148838" target="_blank"&gt;@amitchandak&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;,&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/19851" target="_blank"&gt;@Ashish_Mathur&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 14:17:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3749018#M146223</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-07T14:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT!! Get Sum of rows by grouping based on column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3749051#M146228</link>
      <description>&lt;P&gt;you could try use GROUPBY, like this :&lt;BR /&gt;TotalSum_CategoryOccasions_MultiSelect_Part2_Modified =&lt;BR /&gt;SUMX(&lt;BR /&gt;GROUPBY(&lt;BR /&gt;df_Brands,&lt;BR /&gt;df_Brands[Category Purchased],&lt;BR /&gt;"TotalSum",&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUMX(&lt;BR /&gt;VALUES(Respondent[Unique_ID]),&lt;BR /&gt;VAR OccasionsYes = CALCULATE(COUNTROWS('df_Occasions'), 'df_Occasions'[value1] = "Yes")&lt;BR /&gt;VAR CategoryYes = CALCULATE(COUNTROWS('df_Category Purchased'), 'df_Category Purchased'[value] = "Yes")&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;OccasionsYes &amp;gt; 0 &amp;amp;&amp;amp;&lt;BR /&gt;CategoryYes &amp;gt; 0 &amp;amp;&amp;amp;&lt;BR /&gt;(&lt;BR /&gt;COUNTROWS(FILTER(Respondent, Respondent[IsBrands] = TRUE())) &amp;gt; 0&lt;BR /&gt;),&lt;BR /&gt;1,&lt;BR /&gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;[TotalSum]&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 14:30:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3749051#M146228</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-07T14:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT!! Get Sum of rows by grouping based on column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3749108#M146230</link>
      <description>&lt;P&gt;Hello&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;thank you for taking your time to answer this question but&lt;BR /&gt;i'm getting this error when i ran this code:&amp;nbsp;Function 'GROUPBY' scalar expressions have to be Aggregation functions over CurrentGroup(). The expression of each Aggregation has to be either a constant or directly reference the columns in CurrentGroup().&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 15:00:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3749108#M146230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-07T15:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT!! Get Sum of rows by grouping based on column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3749307#M146240</link>
      <description>&lt;P&gt;Maybe u can use a function summarizecolumns to solve this.&lt;BR /&gt;like this&amp;nbsp;&lt;BR /&gt;TotalSum_CategoryOccasions_MultiSelect_Part2_Modified =&lt;BR /&gt;SUMX(&lt;BR /&gt;SUMMARIZECOLUMNS(&lt;BR /&gt;df_Brands[Category Purchased],&lt;BR /&gt;"TotalSum",&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUMX(&lt;BR /&gt;VALUES(Respondent[Unique_ID]),&lt;BR /&gt;VAR OccasionsYes = CALCULATE(COUNTROWS('df_Occasions'), 'df_Occasions'[value1] = "Yes")&lt;BR /&gt;VAR CategoryYes = CALCULATE(COUNTROWS('df_Category Purchased'), 'df_Category Purchased'[value] = "Yes")&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;OccasionsYes &amp;gt; 0 &amp;amp;&amp;amp;&lt;BR /&gt;CategoryYes &amp;gt; 0 &amp;amp;&amp;amp;&lt;BR /&gt;(&lt;BR /&gt;COUNTROWS(FILTER(Respondent, Respondent[IsBrands] = TRUE())) &amp;gt; 0&lt;BR /&gt;),&lt;BR /&gt;1,&lt;BR /&gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;[TotalSum]&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 16:31:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3749307#M146240</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-07T16:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT!! Get Sum of rows by grouping based on column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3750109#M146275</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp; ,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for giving us a specific DAX code and a detailed description of the problem. Based on your description, it seems like you want to calculate the sum of each category in the column df_Brands [Category Purchased], considering specific criteria. Here's a revised version of the DAX formula that should meet the requirements:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SUMX(
    VALUES(df_Brands[Category Purchased]), 
    VAR CurrentCategory = df_Brands[Category Purchased]
    VAR OccasionsYes = CALCULATE(COUNTROWS('df_Occasions'), 'df_Occasions'[value1] = "Yes", 'df_Brands'[Category Purchased] = CurrentCategory)
    VAR CategoryYes = CALCULATE(COUNTROWS('df_Category Purchased'), 'df_Category Purchased'[value] = "Yes", 'df_Brands'[Category Purchased] = CurrentCategory)
    RETURN
        IF(
            OccasionsYes &amp;gt; 0 &amp;amp;&amp;amp;
            CategoryYes &amp;gt; 0 &amp;amp;&amp;amp;
            (
                COUNTROWS(FILTER(Respondent, Respondent[IsBrands] = TRUE() &amp;amp;&amp;amp; Respondent[Category Purchased] = CurrentCategory)) &amp;gt; 0 
            ),
            1,
            0
        )
)
&lt;/LI-CODE&gt;
&lt;P&gt;If you have any challenges or other issues implementing this solution, can you share the specific data ( including table and model ) you have used in text and image format? This will help diagnose the problem more effectively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Caroline Mei&lt;BR /&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 02:10:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3750109#M146275</guid>
      <dc:creator>v-yanimei-msft</dc:creator>
      <dc:date>2024-03-08T02:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT!! Get Sum of rows by grouping based on column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3751061#M146296</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="696297" data-lia-user-login="v-yanimei-msft" class="lia-mention lia-mention-user"&gt;v-yanimei-msft&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for taking the time to answer this question.&lt;BR /&gt;I implemented this code but got only 1 for the brands in my table:&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;Here is the link to the sample pbix for &lt;A href="https://drive.google.com/file/d/1JQbD4oyYVi5cLjne7oxOZyZ_MKDUh-dW/view?usp=sharing" target="_self"&gt;you:&amp;nbsp;https://drive.google.com/file/d/1JQbD4oyYVi5cLjne7oxOZyZ_MKDUh-dW/view?usp=sharing&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please refer to this and see if your able to help me out!!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 09:20:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/URGENT-Get-Sum-of-rows-by-grouping-based-on-column/m-p/3751061#M146296</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-08T09:20:21Z</dc:date>
    </item>
  </channel>
</rss>

