<?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: Working with values in matrix table on another page in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2760584#M85545</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;I need to perform a calculation for each product that involves looking up the market share values in the market share table.&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;Can you describe the business rules for that calculation? It is not clear (to me)&amp;nbsp; from the Excel page what these rules should be.&amp;nbsp; You shouldn't need to use any intermediate tables or lookups - a standard measure should suffice.&amp;nbsp; Your "Market Share YoY" measure seems to look ok?&amp;nbsp;&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;</description>
    <pubDate>Sun, 11 Sep 2022 23:03:52 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2022-09-11T23:03:52Z</dc:date>
    <item>
      <title>Working with values in matrix table on another page</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2759334#M85480</link>
      <description>&lt;P&gt;I have a two-step calculation that seems to require that I first calculate values in a matrix table and then summarize those values in a different table. It's easy enough in Excel, but I don't know if it's possible in Power BI.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I'm starting with sales data by year, product type, product, region, and vendor. My matrix/pivot table sums sales per vendor by product and year, which is presented as percent of total to give market share. This gives me a table of market share per vendor by product and year. The table can be filtered by product type and region. That's easy enough in both Excel and Power BI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next, I need to perform a calculation for each product that involves looking up the market share values in the market share table. This is the part I can't figure out in Power BI. In Excel, I just use an INDEX lookup for values in the first table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get a better idea of what I'm talking about, here is the Excel version, which works:&lt;/P&gt;&lt;P&gt;&lt;A href="https://1drv.ms/x/s!AgIj2L_vt8WrhtY10w-k2CgxpH-3lA?e=7DHqUx" target="_blank" rel="noopener"&gt;Excel version&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is the Power BI version, where I'm stuck:&lt;/P&gt;&lt;P&gt;&lt;A href="https://1drv.ms/u/s!AgIj2L_vt8WrhtY0TKiE7iZjNMuz1w?e=S6GKVV" target="_self"&gt;Power BI version&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm hoping there's some clever subquery DAX coding that can replicate what I'm doing in Excel without having to create the intermediate table. Unfortunately, the stack in my brain just isn't that deep.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Sep 2022 06:57:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2759334#M85480</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-10T06:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Working with values in matrix table on another page</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2760584#M85545</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;I need to perform a calculation for each product that involves looking up the market share values in the market share table.&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;Can you describe the business rules for that calculation? It is not clear (to me)&amp;nbsp; from the Excel page what these rules should be.&amp;nbsp; You shouldn't need to use any intermediate tables or lookups - a standard measure should suffice.&amp;nbsp; Your "Market Share YoY" measure seems to look ok?&amp;nbsp;&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;</description>
      <pubDate>Sun, 11 Sep 2022 23:03:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2760584#M85545</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-09-11T23:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Working with values in matrix table on another page</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2760603#M85547</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;Thank you for your reply. I've been trying to use implicit measures, but by desire is greater than my skills.&lt;BR /&gt;The business rules are essentially as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;Market Share = DIVIDE&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;[Revenue]&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Revenue]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;dim_Vendors&lt;/SPAN&gt;&lt;SPAN&gt;[Vendor]&lt;/SPAN&gt;&lt;SPAN&gt;)),&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;Market Share YoY = &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; currentYeartMS = [Market Share]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; priorYearMS = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;([Market Share], &lt;/SPAN&gt;&lt;SPAN&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN&gt;('dim_Date'[Date]))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(priorYearMS = &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;currentYeartMS - priorYearMS)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;The index for each year-over-year period and product is the square root of the sum of the squares of the [Market Share YoY] measure for each vendor that sold the product in that year in the current filter context. That is,&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Index = sqrt(VendorA[Market Share YoY]^2 + VendorB[Market Share YoY]^2 + ...)/(number of vendors with non-zero market share)&lt;/FONT&gt;&lt;BR /&gt;This is what the Excel LET() function is calculating:&lt;BR /&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;=LET(&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;Year2018,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INDEX(marketShares,,ROW(&lt;SPAN&gt;B1&lt;/SPAN&gt;)*&lt;SPAN&gt;$C$1&lt;/SPAN&gt;-2),&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;Year2019,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INDEX(marketShares,,ROW(&lt;SPAN&gt;B1&lt;/SPAN&gt;)*&lt;SPAN&gt;$C$1&lt;/SPAN&gt;-1),&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;SQRT(SUM(((100*Year2019)-(100*Year2018))^2))/&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; COUNTIF(INDEX(marketShares,,ROW(&lt;SPAN&gt;B1&lt;/SPAN&gt;)*&lt;SPAN&gt;$C$1&lt;/SPAN&gt;-1),"&amp;lt;&amp;gt;0")&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;Where $C$1 is the number of years spanned by the data (in this case, 3). The ROW(B1*numYears-n) calculation is used to select the target column in the INDEX() function. Kludgy, I know, but that's how I got Excel to do what I wanted.&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;I then want to plot the index values over the time span of the data. For the sample data provided, the two data points for each product would be&amp;nbsp;2018-2019 and 2019-2020, as in the Excel graph.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;Let me know if this helps, or if this still doesn't make sense.&lt;BR /&gt;Thanks again.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 11 Sep 2022 23:31:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2760603#M85547</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-11T23:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Working with values in matrix table on another page</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2760644#M85549</link>
      <description>&lt;P&gt;This should do it&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Index = 
var v = addcolumns(values(data[Vendor]),"Y",[Market Share YoY])
return divide(SQRT(sumx(v,[Y]*[Y])),countrows(v),0)&lt;/LI-CODE&gt;
&lt;P&gt;see attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 00:24:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2760644#M85549</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-09-12T00:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Working with values in matrix table on another page</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2760804#M85566</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;Thank you so much!&lt;BR /&gt;Your solution is almost perfect. The only issue is with the countrows(v) denominator. The intent is to divide by the number of vendors who sell a given product.&amp;nbsp; In my test file, each product is sold by only 2 out of the 3 available vendors. Using countrows(v) will always return 3. Also - a very minor point - I multiply the market share numbers by 100.&amp;nbsp;&lt;BR /&gt;I made the following tweaks to your Index formula, and it now matches the Excel file:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;Index2 = &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; msTable = &lt;/SPAN&gt;&lt;SPAN&gt;ADDCOLUMNS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(dim_Vendors[Vendor]), &lt;/SPAN&gt;&lt;SPAN&gt;"YoY"&lt;/SPAN&gt;&lt;SPAN&gt;, [Market Share YoY])&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SQRT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(msTable, ([YoY]*&lt;/SPAN&gt;&lt;SPAN&gt;100&lt;/SPAN&gt;&lt;SPAN&gt;)^&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;)),&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;('data'[Vendor]),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 'data'[Vendor] &amp;lt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;BLANK&lt;/SPAN&gt;&lt;SPAN&gt;()),&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 12 Sep 2022 03:18:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-with-values-in-matrix-table-on-another-page/m-p/2760804#M85566</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-12T03:18:50Z</dc:date>
    </item>
  </channel>
</rss>

