<?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 Using same column in rows and columns of matrix visual:  Detecting row vs column context in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/2914100#M95321</link>
    <description>&lt;P&gt;I have different bands of customers defined based on their average monthly sales.&amp;nbsp; I'd like to display a matrix of migration between the bands i.e. how many customers have moved from band x to band y:&lt;/P&gt;&lt;P&gt;Customer band now&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/P&gt;&lt;P&gt;Customer band 3 months ago&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The values in the columns and rows will of course be identical.&amp;nbsp; I'm pretty sure you just can't have the same table column on the row and column of the matrix visual.&amp;nbsp; My solution is to duplicate the values in another table, providing the structure for this table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, my actual question is around detecting the filter context:&amp;nbsp; I have used SELECTEVALUE, ISINSCOPE, ISFILTERED previously.&amp;nbsp; Within DAX, is there a way to detect whether these filters originate from the row context, column context or from a filter applied to the visual.&amp;nbsp; Also, is there a way to detect whether the filter is at the visual, page or report level?&amp;nbsp; I imagine you could find some use cases for that kind of information.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Nov 2022 02:02:18 GMT</pubDate>
    <dc:creator>ghaines</dc:creator>
    <dc:date>2022-11-18T02:02:18Z</dc:date>
    <item>
      <title>Using same column in rows and columns of matrix visual:  Detecting row vs column context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/2914100#M95321</link>
      <description>&lt;P&gt;I have different bands of customers defined based on their average monthly sales.&amp;nbsp; I'd like to display a matrix of migration between the bands i.e. how many customers have moved from band x to band y:&lt;/P&gt;&lt;P&gt;Customer band now&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/P&gt;&lt;P&gt;Customer band 3 months ago&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The values in the columns and rows will of course be identical.&amp;nbsp; I'm pretty sure you just can't have the same table column on the row and column of the matrix visual.&amp;nbsp; My solution is to duplicate the values in another table, providing the structure for this table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, my actual question is around detecting the filter context:&amp;nbsp; I have used SELECTEVALUE, ISINSCOPE, ISFILTERED previously.&amp;nbsp; Within DAX, is there a way to detect whether these filters originate from the row context, column context or from a filter applied to the visual.&amp;nbsp; Also, is there a way to detect whether the filter is at the visual, page or report level?&amp;nbsp; I imagine you could find some use cases for that kind of information.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 02:02:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/2914100#M95321</guid>
      <dc:creator>ghaines</dc:creator>
      <dc:date>2022-11-18T02:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using same column in rows and columns of matrix visual:  Detecting row vs column context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/2914116#M95325</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="304963" data-lia-user-login="ghaines" class="lia-mention lia-mention-user"&gt;ghaines&lt;/a&gt; No, DAX is pretty clueless about stuff like that. There is ISFILTERED and ISCROSSFILTERED but that's about it.&lt;/P&gt;
&lt;P&gt;&lt;div data-video-id="http://youtu.be/HHOByJgamWc" data-video-remote-vid="http://youtu.be/HHOByJgamWc" class="lia-video-container lia-media-is-center lia-media-size-small"&gt;&lt;iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FHHOByJgamWc%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DHHOByJgamWc&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FHHOByJgamWc%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" allowfullscreen="" style="max-width: 100%"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 02:19:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/2914116#M95325</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-11-18T02:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using same column in rows and columns of matrix visual:  Detecting row vs column context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/2914124#M95327</link>
      <description>&lt;P&gt;Thought so, thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 02:24:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/2914124#M95327</guid>
      <dc:creator>ghaines</dc:creator>
      <dc:date>2022-11-18T02:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using same column in rows and columns of matrix visual:  Detecting row vs column context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715440#M144607</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a similar matrix as I have produced through sample dataset.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have different Lifecycles and I'm trying to show the migration of customers through different lifecycle over time.&lt;/P&gt;&lt;P&gt;My question is around how do I use same field in rows and columns. And also make it dynamic based on the selected time period.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 00:08:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715440#M144607</guid>
      <dc:creator>tpaliwal</dc:creator>
      <dc:date>2024-02-22T00:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using same column in rows and columns of matrix visual:  Detecting row vs column context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715442#M144608</link>
      <description>&lt;P&gt;My matrix was made with two disconnected tables that were identical except for name, and were used for the row and column axes of the matrix.&amp;nbsp; I could then use the values in row and column to define the logic of the dax expression that created the return value.&amp;nbsp; I don't think it's possible to read two different table contexts from row and column contexts.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 00:14:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715442#M144608</guid>
      <dc:creator>ghaines</dc:creator>
      <dc:date>2024-02-22T00:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using same column in rows and columns of matrix visual:  Detecting row vs column context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715445#M144609</link>
      <description>&lt;P&gt;Hi Ghaines,&lt;/P&gt;&lt;P&gt;Is it possible for you to share the PBIX file so that I can see the logic and use of DAX?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your help!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 00:19:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715445#M144609</guid>
      <dc:creator>tpaliwal</dc:creator>
      <dc:date>2024-02-22T00:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using same column in rows and columns of matrix visual:  Detecting row vs column context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715446#M144610</link>
      <description>&lt;P&gt;No, sorry.&amp;nbsp; The dax expressions and disconnected tables contain strata of unit sales/month for different customers that would give some indication of our financials, and there is identifying information throughout.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 00:23:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715446#M144610</guid>
      <dc:creator>ghaines</dc:creator>
      <dc:date>2024-02-22T00:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using same column in rows and columns of matrix visual:  Detecting row vs column context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715455#M144611</link>
      <description>&lt;P&gt;Totally understand, no worries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is a way for you to show the DAX by changing the names that will be helpful.&lt;/P&gt;&lt;P&gt;If not possible then that's okay.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 00:27:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715455#M144611</guid>
      <dc:creator>tpaliwal</dc:creator>
      <dc:date>2024-02-22T00:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using same column in rows and columns of matrix visual:  Detecting row vs column context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715468#M144612</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;BandsVariablePeriodUnitsDoubleFiltered = 
VAR LowerLimitPrev = MIN('_Customer Bands by Unit Sales Alt (Columns)'[GTOET])
VAR UpperLimitPrev = MAX('_Customer Bands by Unit Sales Alt (Columns)'[LT])

VAR LowerLimitCurr = MIN('_Customer Bands by Unit Sales'[GTOET])
VAR UpperLimitCurr = MAX('_Customer Bands by Unit Sales'[LT])
VAR CustomerFilter = FILTER(VALUES(Customers[Customer Name]),
        [_BandsUnitsCYPeriod]&amp;gt; 0 &amp;amp;&amp;amp; [_BandsUnitsCYPeriod] &amp;gt;= LowerLimitCurr &amp;amp;&amp;amp; [_BandsUnitsCYPeriod] &amp;lt; UpperLimitCurr &amp;amp;&amp;amp;
        [_BandsUnitsVariableComparisonPeriod] &amp;gt; 0 &amp;amp;&amp;amp;
        [_BandsUnitsVariableComparisonPeriod] &amp;gt;= LowerLimitPrev &amp;amp;&amp;amp; 
        [_BandsUnitsVariableComparisonPeriod] &amp;lt; UpperLimitPrev
)

    


RETURN 
CALCULATE(COUNTROWS(DISTINCT(VALUES(Customers[Customer Name]))),
    CustomerFilter)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote it a while ago, it's a bit messy.&amp;nbsp; The "Customer Bands by Unit Sales" type tables are the disconnected tables, with bands defined by sales less than (LT) a value, and greater than or equal to (GTOET) a value.&amp;nbsp; I then filter the customer list based on where it falls in the context.&amp;nbsp; Since I am looking for migration between bands and the bands do not include 0 sales, I filter those out too.&amp;nbsp; Lost and gained customers is a separate visual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the distinct method in the return is superfluous but I'm not going to poke the bear.&amp;nbsp; The reason I evaluate VALUES([Customer Name]) is because our data is rife with duplicates and some have the same name directly because of that.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 00:39:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-same-column-in-rows-and-columns-of-matrix-visual-Detecting/m-p/3715468#M144612</guid>
      <dc:creator>ghaines</dc:creator>
      <dc:date>2024-02-22T00:39:04Z</dc:date>
    </item>
  </channel>
</rss>

