<?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: How to sum up data having same label (DAX Query)? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1673716#M34240</link>
    <description>&lt;P&gt;Nah, this isn't it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the effort though.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2021 07:00:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-02-18T07:00:09Z</dc:date>
    <item>
      <title>How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1672114#M34190</link>
      <description>&lt;P&gt;So this one is pretty tough to explain.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table. It has tons of columns. Every row has an associated label (column) and multiple rows might have the same label.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the issue is, when I represent the data in a matrix, I need to sum up data belonging to a label. How do I do that in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;- There are 10 rows having a label ( a column ) as -1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;- There are also 10-20 rows having a label -2 and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I represent the data in a matrix, what I need is the summation of the data in the rows having label -2. For the next row in the matrix, I need the summation of the data having label -3 and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought a dax query like :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Previous_week_data =&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;var check = MAX(table[label]) - 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;return&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALCULATE( SUM(table[data]), table[label] = check)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this isn't working in a matrix. It shows the latest data properly in a card but not in a matrix. It should work since I want to filter out only those data having a specific label and as the context row changes, the label should change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly help me.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 15:04:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1672114#M34190</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-17T15:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1672639#M34205</link>
      <description>&lt;P&gt;A data sample would be nice (and desired output).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you summing the data in one column only? If so, it looks like you can create a measure = SUM(table[thecolumn]).&lt;/P&gt;
&lt;P&gt;Put the label in the Rows of a matrix, the measure in the Values section.&lt;/P&gt;
&lt;P&gt;Let me know if I've understood it correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 19:48:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1672639#M34205</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2021-02-17T19:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1673532#M34235</link>
      <description>&lt;P&gt;Umm, no.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll provide a snapshot and try to explain my problem in a better way.&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;P&gt;So, as you can see every row in the matrix has an associated label. Which means in the dataset, for instance - for week : 2021-W23 (which is a text, not a date format) all the thousands of rows having visits data have a label of -31. The visits of the weeks are naturally summed up when I represent them in a matrix. Mind you I have done some computation to represent the label in the manner otherwise it was also being summed up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So all I want is the visits value of the previous row in every row. So for 2021-W23, the prev_week will be blank. For 2021-W24, the prev_week should have the visits value of 2021-W23 and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly help me out.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 05:42:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1673532#M34235</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-18T05:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1673649#M34238</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this&amp;nbsp;&lt;A href="https://dax.do/AAXpIq7duYgHD0/" target="_blank" rel="noopener"&gt;&amp;nbsp;code&lt;/A&gt; helps you to understand a potential solution using naturalinnerjoin. pls let me know if you have further questions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 06:40:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1673649#M34238</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2021-02-18T06:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1673716#M34240</link>
      <description>&lt;P&gt;Nah, this isn't it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the effort though.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 07:00:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1673716#M34240</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-18T07:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1673893#M34247</link>
      <description>&lt;P&gt;Perhaps this is what you are looking for:&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;DEFINE
    MEASURE 'Date'[Rank] =
        RANKX (
            ALL ( 'Date'[Calendar Year Month] ),
            CALCULATE ( SUM ( Sales[Quantity] ) ),,,SKIP) 
    MEASURE 'Date'[SalesPrevPeriod] =
        VAR _r = 'Date'[Rank] - 1
        RETURN
            MAXX (
                FILTER (               
                        ADDCOLUMNS (
                            ALL ( 'Date'[Calendar Year Month] ),
                            "sales", CALCULATE ( SUM ( Sales[Quantity] ) ),
                            "rank", 'Date'[Rank]
                        ),                   
                    [rank] = _r
                ),
                [sales]
            )
EVALUATE
ADDCOLUMNS (
    VALUES ( 'Date'[Calendar Year Month] ),
    "sales", CALCULATE ( SUM ( Sales[Quantity] ) ),
    "t", [Rank],
    "salesprevperiod", [SalesPrevPeriod]
)
ORDER BY [t]
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See it working &lt;STRONG&gt;&lt;A href="https://dax.do/fvFCpDwGInkghv/" target="_self"&gt;here&lt;/A&gt;&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steve.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 07:56:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1673893#M34247</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2021-02-18T07:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1674291#M34260</link>
      <description>&lt;P&gt;Could you explain the code?&lt;/P&gt;&lt;P&gt;I am not able to understand it in this context&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 09:50:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1674291#M34260</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-18T09:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1674319#M34261</link>
      <description>&lt;P&gt;In the example that I provide the column YearMonth represents Week in your case, sales represents visits and t (rank) represents Label.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create a measure in your dashboard that matches SalesPrevPeriod in the example.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So in your case you would search the value for the records where the label is one minus the current row value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 09:58:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1674319#M34261</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2021-02-18T09:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1675337#M34315</link>
      <description>&lt;P&gt;Nope.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your code does something entirely different. Here your rank is unique to every row i.e for every sales value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need you to understand is, my table has millions of rows. So for instance for a given week, there are millions of data rows &lt;STRONG&gt;BUT&lt;/STRONG&gt; they have a label and that's the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The given matrix I posted sums up the millions of the visits belonging to the respective fiscal week which itself has dates varying in the 7 days. That complicates the process. Moreover I can't run the code you posted since power bi is falling short of memory.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 17:21:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1675337#M34315</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-18T17:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum up data having same label (DAX Query)?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1675414#M34317</link>
      <description>&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 18:10:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-up-data-having-same-label-DAX-Query/m-p/1675414#M34317</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2021-02-18T18:10:20Z</dc:date>
    </item>
  </channel>
</rss>

