<?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: Shift dates based on slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Shift-dates-based-on-slicer/m-p/3708120#M144257</link>
    <description>&lt;P&gt;To achieve the described functionality, you'll need to create a calculated column or measure in Power BI that calculates the halfway point for each client based on the selected product or region. Here's a breakdown of the steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Identify the Selected Product/Region&lt;/STRONG&gt;: You need to identify the selected product or region using a slicer. This will be used to filter the data.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Calculate Halfway Point for Each Client's Journey&lt;/STRONG&gt;: Determine the halfway point between the start date and end date for the selected product or region of each client. This will be the shifting point for each client's journey.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Shift the Dataset&lt;/STRONG&gt;: Shift the dataset for each client based on the calculated halfway point.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's how you can implement this in DAX:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ShiftedStartDate =&lt;BR /&gt;VAR SelectedProductOrRegion = SELECTEDVALUE('client-data'[PRODUCT])&lt;BR /&gt;VAR ClientID = 'client-data'[ClientNr]&lt;BR /&gt;VAR HalfwayPoint =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;MIN('client-data'[STARTDATE]) +&lt;BR /&gt;(MIN('client-data'[ENDDATE]) - MIN('client-data'[STARTDATE])) / 2,&lt;BR /&gt;FILTER('client-data', 'client-data'[PRODUCT] = SelectedProductOrRegion),&lt;BR /&gt;FILTER('client-data', 'client-data'[ClientNr] = ClientID)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;'client-data'[STARTDATE] + HalfwayPoint - CALCULATE(MIN('client-data'[STARTDATE]), 'client-data'[ClientNr] = ClientID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This DAX formula assumes that 'client-data' is your client table, and you have columns like [ClientNr], [STARTDATE], [ENDDATE], and [PRODUCT]. Replace these with your actual column names.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The SELECTEDVALUE function gets the selected product or region from the slicer.&lt;/LI&gt;&lt;LI&gt;The CALCULATE function calculates the halfway point for the selected product or region for each client.&lt;/LI&gt;&lt;LI&gt;The FILTER function filters the data to calculate the halfway point for each client.&lt;/LI&gt;&lt;LI&gt;The RETURN statement returns the shifted start date based on the halfway point.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You can create a calculated column or measure using this DAX formula, depending on your requirement. Adjust the formula according to your data model and relationships.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Feb 2024 13:28:46 GMT</pubDate>
    <dc:creator>123abc</dc:creator>
    <dc:date>2024-02-19T13:28:46Z</dc:date>
    <item>
      <title>Shift dates based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Shift-dates-based-on-slicer/m-p/3707371#M144214</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a pretty difficult DAX command which I can't figure out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End-goal: I need to compare customer journies of our clients . Therefore I need/want to overlap the journies over each other.&lt;/P&gt;&lt;P&gt;How I imagine it:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;the user selects a product or region using a slicer which applies it on a table called "client-data"&lt;BR /&gt;&lt;OL&gt;&lt;LI&gt;the user shouldn't be able to filter on a client but a product or region. on which the user likes to zoom in.&lt;/LI&gt;&lt;LI&gt;the "client-data" table is uncoupeled from the "Master" table because one client has multiple lines with different products or regions which all need to be taken into account.&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;The halfwaypoint (End_date - Start_date)/2 of the selected product of each client needs to used to shift the whole dataset of the client.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;if the selected product is repeated in use by a client, choose the first one.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;visually -&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;clienttable:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Region&lt;/TD&gt;&lt;TD&gt;PRODUCT&lt;/TD&gt;&lt;TD&gt;ClientNr&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;PR_1&lt;/TD&gt;&lt;TD&gt;CL_1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;PR_2&lt;/TD&gt;&lt;TD&gt;CL_1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&g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t;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;..&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 08:53:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Shift-dates-based-on-slicer/m-p/3707371#M144214</guid>
      <dc:creator>Shliim_1</dc:creator>
      <dc:date>2024-02-19T08:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Shift dates based on slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Shift-dates-based-on-slicer/m-p/3708120#M144257</link>
      <description>&lt;P&gt;To achieve the described functionality, you'll need to create a calculated column or measure in Power BI that calculates the halfway point for each client based on the selected product or region. Here's a breakdown of the steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Identify the Selected Product/Region&lt;/STRONG&gt;: You need to identify the selected product or region using a slicer. This will be used to filter the data.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Calculate Halfway Point for Each Client's Journey&lt;/STRONG&gt;: Determine the halfway point between the start date and end date for the selected product or region of each client. This will be the shifting point for each client's journey.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Shift the Dataset&lt;/STRONG&gt;: Shift the dataset for each client based on the calculated halfway point.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's how you can implement this in DAX:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ShiftedStartDate =&lt;BR /&gt;VAR SelectedProductOrRegion = SELECTEDVALUE('client-data'[PRODUCT])&lt;BR /&gt;VAR ClientID = 'client-data'[ClientNr]&lt;BR /&gt;VAR HalfwayPoint =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;MIN('client-data'[STARTDATE]) +&lt;BR /&gt;(MIN('client-data'[ENDDATE]) - MIN('client-data'[STARTDATE])) / 2,&lt;BR /&gt;FILTER('client-data', 'client-data'[PRODUCT] = SelectedProductOrRegion),&lt;BR /&gt;FILTER('client-data', 'client-data'[ClientNr] = ClientID)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;'client-data'[STARTDATE] + HalfwayPoint - CALCULATE(MIN('client-data'[STARTDATE]), 'client-data'[ClientNr] = ClientID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This DAX formula assumes that 'client-data' is your client table, and you have columns like [ClientNr], [STARTDATE], [ENDDATE], and [PRODUCT]. Replace these with your actual column names.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The SELECTEDVALUE function gets the selected product or region from the slicer.&lt;/LI&gt;&lt;LI&gt;The CALCULATE function calculates the halfway point for the selected product or region for each client.&lt;/LI&gt;&lt;LI&gt;The FILTER function filters the data to calculate the halfway point for each client.&lt;/LI&gt;&lt;LI&gt;The RETURN statement returns the shifted start date based on the halfway point.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You can create a calculated column or measure using this DAX formula, depending on your requirement. Adjust the formula according to your data model and relationships.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 13:28:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Shift-dates-based-on-slicer/m-p/3708120#M144257</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-02-19T13:28:46Z</dc:date>
    </item>
  </channel>
</rss>

