<?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 Sort by column values with multiple fields in rows in matrix in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-by-column-values-with-multiple-fields-in-rows-in-matrix/m-p/3410613#M128914</link>
    <description>&lt;P&gt;Hi, I need to display Country and Customer coming from different Dim tables and show them in rows in matrix visual. The field ( Product) in Columns in Matrix is from a different Dim table all connected to Fact table by one-to-many relationship.&lt;BR /&gt;&lt;BR /&gt;The below measure works fine when I have either Country or Customer in rows, but as soon as I add both fields, the measure doesn't like it.&lt;BR /&gt;I need to basically highlight the minimum value for each Product column by using the below measure in Conditional formatting.&lt;BR /&gt;The measure I tried -&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Background Measure =&lt;/P&gt;&lt;P&gt;VAR _1 = CALCULATETABLE(&lt;BR /&gt;ADDCOLUMNS&lt;BR /&gt;(SUMMARIZE('Fact','Dim Country'[Country], 'Dim Product'[Product]),&lt;BR /&gt;"@Amt", [Value]&lt;BR /&gt;),&lt;BR /&gt;ALLSELECTED(''Dim Product'[Product])&lt;BR /&gt;)&lt;BR /&gt;var MinValue = MINX(_1, [@Amt])&lt;BR /&gt;var MaxValue = MAXX(_1, [@Amt])&lt;BR /&gt;var CurrentValue = [Value]&lt;BR /&gt;var Result =&lt;BR /&gt;SWITCH(TRUE(),&lt;BR /&gt;CurrentValue = MinValue, 1,&lt;BR /&gt;CurrentValue = MaxValue, 2, BLANK())&lt;BR /&gt;RETURN Result&lt;BR /&gt;&lt;BR /&gt;If I add Country to rows in matrix&amp;nbsp; and customer coming from Dim Customer[Customer] to the above measure in summarize, it does not give right result. It only works when I have one field say Country in rows and product in columns.Could someone guide on what I am doing wrong? I need the below output when both Country and Customer are in rows.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Sep 2023 11:12:49 GMT</pubDate>
    <dc:creator>askpbiuser</dc:creator>
    <dc:date>2023-09-01T11:12:49Z</dc:date>
    <item>
      <title>Sort by column values with multiple fields in rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-by-column-values-with-multiple-fields-in-rows-in-matrix/m-p/3410613#M128914</link>
      <description>&lt;P&gt;Hi, I need to display Country and Customer coming from different Dim tables and show them in rows in matrix visual. The field ( Product) in Columns in Matrix is from a different Dim table all connected to Fact table by one-to-many relationship.&lt;BR /&gt;&lt;BR /&gt;The below measure works fine when I have either Country or Customer in rows, but as soon as I add both fields, the measure doesn't like it.&lt;BR /&gt;I need to basically highlight the minimum value for each Product column by using the below measure in Conditional formatting.&lt;BR /&gt;The measure I tried -&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Background Measure =&lt;/P&gt;&lt;P&gt;VAR _1 = CALCULATETABLE(&lt;BR /&gt;ADDCOLUMNS&lt;BR /&gt;(SUMMARIZE('Fact','Dim Country'[Country], 'Dim Product'[Product]),&lt;BR /&gt;"@Amt", [Value]&lt;BR /&gt;),&lt;BR /&gt;ALLSELECTED(''Dim Product'[Product])&lt;BR /&gt;)&lt;BR /&gt;var MinValue = MINX(_1, [@Amt])&lt;BR /&gt;var MaxValue = MAXX(_1, [@Amt])&lt;BR /&gt;var CurrentValue = [Value]&lt;BR /&gt;var Result =&lt;BR /&gt;SWITCH(TRUE(),&lt;BR /&gt;CurrentValue = MinValue, 1,&lt;BR /&gt;CurrentValue = MaxValue, 2, BLANK())&lt;BR /&gt;RETURN Result&lt;BR /&gt;&lt;BR /&gt;If I add Country to rows in matrix&amp;nbsp; and customer coming from Dim Customer[Customer] to the above measure in summarize, it does not give right result. It only works when I have one field say Country in rows and product in columns.Could someone guide on what I am doing wrong? I need the below output when both Country and Customer are in rows.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 11:12:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-by-column-values-with-multiple-fields-in-rows-in-matrix/m-p/3410613#M128914</guid>
      <dc:creator>askpbiuser</dc:creator>
      <dc:date>2023-09-01T11:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sort by column values with multiple fields in rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-by-column-values-with-multiple-fields-in-rows-in-matrix/m-p/3412785#M129050</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="611399" data-lia-user-login="askpbiuser" class="lia-mention lia-mention-user"&gt;askpbiuser&lt;/a&gt;&amp;nbsp; your part for SUMMARIZE define "later" output&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SUMMARIZE('Fact','Dim Country'[Country], 'Dim Product'[Product])&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;combined with&amp;nbsp;ALLSELECTED(&lt;FONT color="#FF0000"&gt;''&lt;/FONT&gt;Dim Product'[Product]) which "missing" Dim Customer table / some column&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Try to add to this part what you need, like customer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope this help. Kudos appreciated.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Sep 2023 19:41:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-by-column-values-with-multiple-fields-in-rows-in-matrix/m-p/3412785#M129050</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2023-09-03T19:41:35Z</dc:date>
    </item>
  </channel>
</rss>

