<?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: Create slicer to choose the active relationship for Date Dimension in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001777#M101373</link>
    <description>&lt;P&gt;Both are used, the same fields used in&amp;nbsp;visuals (breaking down sums by things like location, fiscal year, etc ) as are used for drilldowns for invoice details (shown in a table)&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2023 19:14:23 GMT</pubDate>
    <dc:creator>wmcclure</dc:creator>
    <dc:date>2023-01-04T19:14:23Z</dc:date>
    <item>
      <title>Create slicer to choose the active relationship for Date Dimension</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001426#M101353</link>
      <description>&lt;P&gt;Hello all! I have been pondering this for a bit and hope that someone may have some useful tips that I might be overlooking, as always, thanks in advance to the PBI community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a set of slicers in a report that can dynamically change the active relationship used between an invoices table and a date table. Essentially, I want to have one date search, and a selector for if the invoice has been paid. If someone from the sales team wants to view only paid invoices, I want the relationship to only look at the Paid Date of the invoice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively, if a member wants to view active invoices, I want the relationship used to be between the date dimension and the Invoice Date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason I want to set it up this way is to link to a dynamic title so that the user knows if they are looking at paid invoices, open invoices, or a combination of the two, while avoiding using 3 seperate filters (Paid Date Slicer, Invoice Date Slicer, and "Is Paid" Selection)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In essence,&lt;BR /&gt;IF "Invoice is paid" = Yes, THEN Date filter -&amp;gt; Paid Date&lt;BR /&gt;IF "Invoice Paid" = No, THEN Date Filter -&amp;gt; Invoice Date&lt;/P&gt;&lt;P&gt;IF "Invoice Paid" = not selected/null (all invoices), THEN Date Filter -&amp;gt; Invoice Date&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 16:04:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001426#M101353</guid>
      <dc:creator>wmcclure</dc:creator>
      <dc:date>2023-01-04T16:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create slicer to choose the active relationship for Date Dimension</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001497#M101355</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="395038" data-lia-user-login="wmcclure" class="lia-mention lia-mention-user"&gt;wmcclure&lt;/a&gt; , if you have active, inactive relationship&amp;nbsp; then you need measures like &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;calculate( SUM(Table[Amount]),USERELATIONSHIP ('Table'[Paid Date], 'Date'[Date]), [Invoice is paid] ="Yes")&lt;/P&gt;
&lt;P&gt;+&lt;/P&gt;
&lt;P&gt;calculate( SUM(Table[Amount]),USERELATIONSHIP ('Table'[Invoice Date], 'Date'[Date]), [Invoice is paid] ="No")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;calculate( SUM(Table[Amount]),USERELATIONSHIP ('Table'[Paid Date], 'Date'[Date]), Filter(Table, [Invoice is paid] ="Yes")) &lt;/P&gt;
&lt;P&gt;+&lt;/P&gt;
&lt;P&gt;calculate( SUM(Table[Amount]),USERELATIONSHIP ('Table'[Invoice Date], 'Date'[Date]),Filter(Table, [Invoice is paid] ="No"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With date table, you need to join bith tables :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;examples&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or have independent date table with no join&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Date1 is independent Date table&lt;BR /&gt;new measure =&lt;BR /&gt;var _max = maxx(allselected(Date1),Date1[Date])&lt;BR /&gt;var _min = minx(allselected(Date1),Date1[Date]) &lt;BR /&gt;return &lt;BR /&gt;calculate( sum(Table[Value]), filter('Table', 'Table'[Invoice Date] &amp;gt;=_min &amp;amp;&amp;amp; 'Table'[Date] &amp;lt;=_max &amp;amp;&amp;amp; [Invoice is paid] ="No")) + calculate( sum(Table[Value]), filter('Table', 'Table'[Paid Date] &amp;gt;=_min &amp;amp;&amp;amp; 'Table'[Date] &amp;lt;=_max &amp;amp;&amp;amp; [Invoice is paid] ="Yes"))&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 16:30:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001497#M101355</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2023-01-04T16:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create slicer to choose the active relationship for Date Dimension</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001531#M101362</link>
      <description>&lt;P&gt;Thank you, but unfortunately with the number of fields that are being used in the dataset, I dont think calculating each of them with a userelationship filter would be the most adventageous for the sake of time, performance, and upkeep. Do you know of any ways to achieve this type of result outside of the options you suggested? I am experimenting with using a paramater as an alternative but have yet to get much experience with that either.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 16:45:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001531#M101362</guid>
      <dc:creator>wmcclure</dc:creator>
      <dc:date>2023-01-04T16:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create slicer to choose the active relationship for Date Dimension</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001625#M101368</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="395038" data-lia-user-login="wmcclure" class="lia-mention lia-mention-user"&gt;wmcclure&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;by field do you mean measures? How many?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 17:39:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001625#M101368</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-04T17:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create slicer to choose the active relationship for Date Dimension</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001633#M101369</link>
      <description>&lt;P&gt;I mean fields as in things that are native to the input tables. And there are close to if not over 100, this dataset is responsible for reporting on things like taxes, sales, costs, margins, down payments, etc, all of which are broken down by a number of categories, etc. Creating measures for each of these in order to adjust which relationship is being drawn doesnt seem to be the right solution for our purposes&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 17:47:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001633#M101369</guid>
      <dc:creator>wmcclure</dc:creator>
      <dc:date>2023-01-04T17:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create slicer to choose the active relationship for Date Dimension</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001641#M101370</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="395038" data-lia-user-login="wmcclure" class="lia-mention lia-mention-user"&gt;wmcclure&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you using a table visual to display these fields? When you add them to the table, do you summarize them by sum for example or you just display the data as is?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 17:52:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001641#M101370</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-04T17:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create slicer to choose the active relationship for Date Dimension</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001777#M101373</link>
      <description>&lt;P&gt;Both are used, the same fields used in&amp;nbsp;visuals (breaking down sums by things like location, fiscal year, etc ) as are used for drilldowns for invoice details (shown in a table)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 19:14:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3001777#M101373</guid>
      <dc:creator>wmcclure</dc:creator>
      <dc:date>2023-01-04T19:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create slicer to choose the active relationship for Date Dimension</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3005335#M101665</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="395038" data-lia-user-login="wmcclure" class="lia-mention lia-mention-user"&gt;wmcclure&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Appologies for the late response. Actually I had to wait until I have the time to prepare a sample file. This is just and idea which I have implemented before for one of my reports. Can share more details about it if you wish.&lt;BR /&gt;In the attached sample file you track the method which basically utilizes&amp;nbsp;a parameter table (manually inserted disconnected table) that contains the names&amp;nbsp;of your measures. Instead of the table visual you need to use a matrix&amp;nbsp;visual, place the measure names field from the parameter table in the columns of the matrix and place all the slicing by columns in the rows of the matrix (you can disable the stepped layout option to obtain the desired appearance). The measure [Final Measure] will be placed in the values of the matrix.&lt;/P&gt;
&lt;P&gt;The method can be summarized into two steps&lt;/P&gt;
&lt;P&gt;Step1: Create the [Grouping Measure] which is a switch statement that selects the measure to be calculated based on the SELECTEDVALUE of the measure name. This is just the same as the field parameter option in power bi.&lt;/P&gt;
&lt;P&gt;Step2: Another switch statement that changes the relationship and hence, the calculation of the selected measure based on the selection of the [Paid?] column in your sales table ("Paid", "Not Paid"). I wasn't sure if you needed this to be part of your sales table so it filters and switches the relationship at the same time or you just needed it to be in a disconnected table to avoid filtering the sales table but only switches the relationship?&lt;/P&gt;
&lt;P&gt;Performance implications of this approach are limited however it shall require customization to suit your case.&lt;/P&gt;
&lt;P&gt;Please let me know if this is helpful to you or if you need any further clarifications.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 09:49:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-slicer-to-choose-the-active-relationship-for-Date/m-p/3005335#M101665</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-06T09:49:38Z</dc:date>
    </item>
  </channel>
</rss>

