<?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: Group by Measure in a Matrix in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/Group-by-Measure-in-a-Matrix/m-p/1791237#M18933</link>
    <description>&lt;P&gt;&lt;SPAN&gt;For anyone else that finds this later. I was able to get this to work and here's how. I used Summarize Columns, with a switch function inside for the segments, I could not figure out how to use a measure or a variable inside the summarize columns function so I just typed the calculation each time. I wrapped the whole thing in a Calculate Table function to add a filter. Below is the code&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATETABLE(
SUMMARIZECOLUMNS(
	 UCS[GuestID]
	,UCS
	,"ADTBand"
	,SWITCH(TRUE(),
	Sum(UCS[Orders]) = 0,"0-14",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;15,"0-14",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=15&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;25,"15-24",
	CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=25&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;40,"25-39",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=40&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;75,"40-74",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=75&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;100,"75-99",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=100&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;150,"100-149",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=150&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;225,"150-224",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=225&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;300,"225-299",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=300&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;400,"300-399",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=400&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;500,"400-499",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=500&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;750,"500-749",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=750&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;1000,"750-999",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=1000&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;1250,"1000-1249",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=1250&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;1500,"1250-1499",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=1500&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;2000,"1500-1999",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=2000&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;2500,"2000-2499",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=2500&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;3000,"2500-2999",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=3000&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;3500,"3000-3499",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=3500,"3500+"
))
,not( UPI[TierID] in {9,10}))&lt;/LI-CODE&gt;</description>
    <pubDate>Sun, 18 Apr 2021 20:20:25 GMT</pubDate>
    <dc:creator>ChadPortman</dc:creator>
    <dc:date>2021-04-18T20:20:25Z</dc:date>
    <item>
      <title>Group by Measure in a Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Group-by-Measure-in-a-Matrix/m-p/1790555#M18927</link>
      <description>&lt;P&gt;I have been searching for answers on this and have found several things that might work but I don't understand how to use them. Hoping someone can help me understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try to explain what all I have and what I am trying to do. I have a measure called AverageDailyWorth that is just a sum of the customers spend divided by the number of trips they have made. I have a second measure using the switch function to roup the customer into ranges based on the AverageDailyWorth. So for example into groups like $0-$14, $15-$49,$50-$99,$100+.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to have a Matrix that lists all of these groupings on the rows and then I can get the combined sum of values in columns for all the members in each group. This is super simple in Excel as I would just do a vlookup to assign to the Grouping and then do a pivot table based on the column from the vlookup. However recreating pivot tables in Power BI seems to be impossible when you are using a measure. At least to me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found the following ideas in my reasearch on this and they might or might not wok but with my limited understanding of the I have not gotten a workable solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;disassociated table&lt;/LI&gt;&lt;LI&gt;virtual table&lt;/LI&gt;&lt;LI&gt;virtual relationships&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I am still very new to Power BI and this foru as well. If there is a way I can provide a file with sample data and that is useful please let me know how. I will gladly make a mock sample file in Power BI as well as the expected result from Excel I would like to recreate.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Apr 2021 16:55:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Group-by-Measure-in-a-Matrix/m-p/1790555#M18927</guid>
      <dc:creator>ChadPortman</dc:creator>
      <dc:date>2021-04-17T16:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: Group by Measure in a Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Group-by-Measure-in-a-Matrix/m-p/1791237#M18933</link>
      <description>&lt;P&gt;&lt;SPAN&gt;For anyone else that finds this later. I was able to get this to work and here's how. I used Summarize Columns, with a switch function inside for the segments, I could not figure out how to use a measure or a variable inside the summarize columns function so I just typed the calculation each time. I wrapped the whole thing in a Calculate Table function to add a filter. Below is the code&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATETABLE(
SUMMARIZECOLUMNS(
	 UCS[GuestID]
	,UCS
	,"ADTBand"
	,SWITCH(TRUE(),
	Sum(UCS[Orders]) = 0,"0-14",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;15,"0-14",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=15&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;25,"15-24",
	CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=25&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;40,"25-39",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=40&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;75,"40-74",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=75&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;100,"75-99",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=100&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;150,"100-149",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=150&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;225,"150-224",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=225&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;300,"225-299",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=300&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;400,"300-399",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=400&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;500,"400-499",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=500&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;750,"500-749",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=750&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;1000,"750-999",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=1000&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;1250,"1000-1249",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=1250&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;1500,"1250-1499",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=1500&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;2000,"1500-1999",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=2000&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;2500,"2000-2499",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=2500&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;3000,"2500-2999",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=3000&amp;amp;&amp;amp;CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;lt;3500,"3000-3499",
    CALCULATE(Sum(UCS[TotalSpend])/CALCULATE(DistinctCount(UCS[Date]),UCS[Orders] = 1))&amp;gt;=3500,"3500+"
))
,not( UPI[TierID] in {9,10}))&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 18 Apr 2021 20:20:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Group-by-Measure-in-a-Matrix/m-p/1791237#M18933</guid>
      <dc:creator>ChadPortman</dc:creator>
      <dc:date>2021-04-18T20:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Group by Measure in a Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Group-by-Measure-in-a-Matrix/m-p/1792457#M18940</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="289962" data-lia-user-login="ChadPortman" class="lia-mention lia-mention-user"&gt;ChadPortman&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Glad to hear that you have found the solution. Please accept your reply as solution to help people who may have the same question get the solution directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition, you can use&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/dax/var-dax" target="_blank" rel="noopener"&gt;VAR&lt;/A&gt; to store the result of an expression as a named variable and use RETURN to give the result.&lt;/P&gt;
&lt;P&gt;Reference:&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/power-bi/guidance/dax-variables" target="_blank"&gt;DAX: Use variables to improve your formulas - Power BI | Microsoft Docs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 10:28:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Group-by-Measure-in-a-Matrix/m-p/1792457#M18940</guid>
      <dc:creator>Icey</dc:creator>
      <dc:date>2021-04-19T10:28:24Z</dc:date>
    </item>
  </channel>
</rss>

