<?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: Conditional Measure using slicer selection in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Measure-using-slicer-selection/m-p/4101001#M162741</link>
    <description>&lt;P&gt;You need to use a disconnected table to feed your date range slicer, and then use measures to filter your visual.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2024 21:10:24 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-08-14T21:10:24Z</dc:date>
    <item>
      <title>Conditional Measure using slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Measure-using-slicer-selection/m-p/4100484#M162718</link>
      <description>&lt;P&gt;I am trying to put together a stacked column chart, using the example table below, I want to show total transactions per month. The one color of the stacked column will show transactions by clients who joined before the start of the selected date range (marked those in &lt;STRONG&gt;bold &lt;/STRONG&gt;below), and the other color of the bar will be transactions by clients who joined after the start of the selected date range (marked those in &lt;EM&gt;italics&lt;/EM&gt; below).&amp;nbsp; The user needs the ability to chose the date range with a slice.&amp;nbsp; In this example let's say the user has chosen 1/1/24 - 3/31/24.&amp;nbsp; So the Jan column would show a total of 18 transactions (16 from old clients, 2 from new), Feb would show 24 transactions (14 from old clients, 10 from new), and Mar would show 33 transactions (13 from old clients, 20 from new).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the user changes the date range, the clients that are considered old or new will change.&amp;nbsp; Here if they changed the range to 2/1/24 - 3/31/24, then client C would change from the new catagory to old.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the user needs control of the date range, I can't code these catagories into the datasource. I know I can't reference a single slicer value in a calculated column formula.&amp;nbsp; So I'm trying to figure out if I can achieve this with a measure, using SWITCH and SELECTEDVALUE to check if a Client_joined date is before or after the start of the date range the user sets, and catagorize the transactions in the visual dynamically that way. Any thoughts on this?&amp;nbsp; Or any other ways I could achieve this result?&amp;nbsp; Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Client&lt;/TD&gt;&lt;TD&gt;Client_joined&lt;/TD&gt;&lt;TD&gt;Transactions&lt;/TD&gt;&lt;TD&gt;Transaction_month&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;5/5/2023&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;9&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;Jan-24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;10/10/2023&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;7&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;Jan-24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1/20/2024&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;2&lt;/EM&gt;&lt;/TD&gt;&lt;TD&gt;Jan-24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;5/5/2023&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;Feb-24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;10/10/2023&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt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t;/TABLE&gt;</description>
      <pubDate>Wed, 14 Aug 2024 14:48:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Measure-using-slicer-selection/m-p/4100484#M162718</guid>
      <dc:creator>Rob92</dc:creator>
      <dc:date>2024-08-14T14:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Measure using slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Measure-using-slicer-selection/m-p/4101001#M162741</link>
      <description>&lt;P&gt;You need to use a disconnected table to feed your date range slicer, and then use measures to filter your visual.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 21:10:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Measure-using-slicer-selection/m-p/4101001#M162741</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-08-14T21:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Measure using slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Measure-using-slicer-selection/m-p/4101515#M162753</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="755215" data-lia-user-login="Rob92" class="lia-mention lia-mention-user"&gt;Rob92&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created a sample pbix file(see &lt;EM&gt;&lt;STRONG&gt;the attachmen&lt;/STRONG&gt;&lt;/EM&gt;t), please check if that is what you want.&lt;/P&gt;
&lt;P&gt;1. Create a &lt;STRONG&gt;sperated&lt;/STRONG&gt; date dimension table(&lt;FONT color="#FF0000"&gt;&lt;EM&gt;DO NOT&lt;/EM&gt; &lt;/FONT&gt;create any relationship with your fact table) just as suggested by Ibendlin&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. Create two measures as below&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Old clients count = 
VAR _mindate =
    MIN ( 'Date'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Transactions] ),
        FILTER ( 'Table', 'Table'[Client_joined] &amp;lt;= _mindate )
    )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;New clients count = 
VAR _mindate =
    MIN ( 'Date'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Transactions] ),
        FILTER ( 'Table', 'Table'[Client_joined] &amp;gt; _mindate )
    )&lt;/LI-CODE&gt;
&lt;P&gt;3. Create a table visual as shown in the below screenshot&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 05:27:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Measure-using-slicer-selection/m-p/4101515#M162753</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-15T05:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Measure using slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Measure-using-slicer-selection/m-p/4102200#M162777</link>
      <description>&lt;P&gt;Awesome, thanks guys!&amp;nbsp; I have implemented the solution on my real data and it works a treat.&amp;nbsp; The only issue was that as well as the slicer controlling which users are new or old, I also need it to filter the visual.&amp;nbsp; In order to do this I &lt;EM&gt;have&lt;/EM&gt; joined the date dimension table to the fact table.&amp;nbsp; This causes the date hierachy to break but that's not a problem - to resolve that, I added separate month and year columns in power query, and used those on the X axis instead.&amp;nbsp; Problem solved!&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>Thu, 15 Aug 2024 11:17:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Measure-using-slicer-selection/m-p/4102200#M162777</guid>
      <dc:creator>Rob92</dc:creator>
      <dc:date>2024-08-15T11:17:10Z</dc:date>
    </item>
  </channel>
</rss>

