<?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: Dynamic 2 Date Columns Difference in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4340782#M172371</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="902274" data-lia-user-login="sammy339" class="lia-mention lia-mention-user"&gt;sammy339&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;May I ask if you have gotten this issue resolved?&lt;/P&gt;
&lt;P&gt;If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Dec 2024 11:45:08 GMT</pubDate>
    <dc:creator>v-sgandrathi</dc:creator>
    <dc:date>2024-12-23T11:45:08Z</dc:date>
    <item>
      <title>Dynamic 2 Date Columns Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4332054#M171987</link>
      <description>&lt;P&gt;You are provided with a dataset containing three date columns (&lt;STRONG&gt;Column1&lt;/STRONG&gt;, &lt;STRONG&gt;Column2&lt;/STRONG&gt;, and &lt;STRONG&gt;Column3&lt;/STRONG&gt;) for multiple projects. The user wants to dynamically calculate the date difference between any two selected date columns using &lt;STRONG&gt;dropdown selections&lt;/STRONG&gt; (parameters) in Power BI. For example, selecting &lt;STRONG&gt;Column3&lt;/STRONG&gt; and &lt;STRONG&gt;Column1&lt;/STRONG&gt; should return the difference in days .&lt;/P&gt;&lt;P&gt;How can you achieve this functionality in Power BI to allow users to choose the two date columns dynamically and display the calculated date difference?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 03:42:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4332054#M171987</guid>
      <dc:creator>sammy339</dc:creator>
      <dc:date>2024-12-17T03:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic 2 Date Columns Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4332117#M171988</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="902274" data-lia-user-login="sammy339" class="lia-mention lia-mention-user"&gt;sammy339&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You can try using field parameter to achive the above logic..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Add all the date columns (Column1, Column2, Column3) into the parameter &amp;gt;&amp;gt; Name the parameter something like DateSelector&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;DateSelector = {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;("Column1", NAMEOF('Table'[Column1]), 0),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;("Column2", NAMEOF('Table'[Column2]), 1),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;("Column3", NAMEOF('Table'[Column3]), 2)}&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;2. Duplicate the DateSelector table and rename it as &lt;FONT color="#FF0000"&gt;DateSelector2&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;3.&amp;nbsp;Create Two Slicers with&amp;nbsp;&lt;FONT color="#FF0000"&gt;DateSelector(Dropdown1)&lt;/FONT&gt; and&amp;nbsp;&lt;FONT color="#FF0000"&gt;DateSelector2(Dropdown2)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;4.&amp;nbsp;You now need a measure to calculate the difference between the two selected dates&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Date Difference = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VAR SelectedDate1 = SELECTEDVALUE(DateSelector[DateSelector Value])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;VAR SelectedDate2 = SELECTEDVALUE(DateSelector2[DateSelector Value])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;IF(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ISBLANK(SelectedDate1) || ISBLANK(SelectedDate2),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;BLANK(),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;DATEDIFF(SELECTEDVALUE('Table'[SelectedDate2]), SELECTEDVALUE('Table'[SelectedDate1]), DAY))&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;5.&amp;nbsp;Add the project names and this &lt;FONT color="#FF0000"&gt;Date Difference&lt;/FONT&gt; measure to a table visual.&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&lt;U&gt;&lt;STRONG&gt;If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; are much appreciated!&lt;/STRONG&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;Dharmendar S&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.linkedin.com/in/dharmendar-s-b5b43463/" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;LinkedIN&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 05:32:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4332117#M171988</guid>
      <dc:creator>dharmendars007</dc:creator>
      <dc:date>2024-12-17T05:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic 2 Date Columns Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4334248#M172082</link>
      <description>Thanks Dharmendar for replying. I tried the above steps and upon using Date Difference in a matrix visual getting error. Is it possible to upload a sample project. Error Message : MdxScript(Model) (4, 21) Calculation error in measure 'Table'[Date Difference]: Column [DateSelector] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression.</description>
      <pubDate>Wed, 18 Dec 2024 05:39:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4334248#M172082</guid>
      <dc:creator>sammy339</dc:creator>
      <dc:date>2024-12-18T05:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic 2 Date Columns Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4334253#M172083</link>
      <description>&lt;P&gt;Thank you Dharmendar for replying. I am getting following error when trying to use date difference measure. Can you please upload a sample project.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Error Message :&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;MdxScript(Model) (4, 21) Calculation error in measure 'Table'[Date Difference]: Column [DateSelector] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 05:43:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4334253#M172083</guid>
      <dc:creator>sammy339</dc:creator>
      <dc:date>2024-12-18T05:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic 2 Date Columns Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4335019#M172120</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="902274" data-lia-user-login="sammy339" class="lia-mention lia-mention-user"&gt;sammy339&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to the Microsoft Fabric Community forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;create a mapping table first like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DateSelector = DATATABLE("DateName", STRING, "ColumnIndex", INTEGER,{{"Column1", 1},{"Column2", 2},{"Column3", 3}})&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;DAX Measure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date Difference =&amp;nbsp;&lt;BR /&gt;VAR SelectedCol1 = SELECTEDVALUE(DateSelector[DateName])&lt;BR /&gt;VAR SelectedCol2 = SELECTEDVALUE(DateSelector2[DateName])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VAR Date1 = SWITCH(TRUE(),SelectedCol1 = "Column1", 'Projects'[Column1],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectedCol1 = "Column2", 'Projects'[Column2],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectedCol1 = "Column3", 'Projects'[Column3])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VAR Date2 = SWITCH(TRUE(),SelectedCol2 = "Column1", 'Projects'[Column1],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectedCol2 = "Column2", 'Projects'[Column2],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectedCol2 = "Column3", 'Projects'[Column3])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RETURN&lt;BR /&gt;IF(ISBLANK(Date1) || ISBLANK(Date2),BLANK(),DATEDIFF(Date1, Date2, DAY))&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;SPAN data-teams="true"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;I have included the PBIX file that I created using the provided sample data. Kindly review it and confirm whether it aligns with your expectations.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post clears your doubt, please give us Kudos and consider marking Accepting it as a solution to guide other members in finding it more easily.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Sahasra.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 04:30:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4335019#M172120</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2025-06-27T04:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic 2 Date Columns Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4338447#M172264</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="902274" data-lia-user-login="sammy339" class="lia-mention lia-mention-user"&gt;sammy339&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Since we haven't heard back from you yet, I'd like to confirm if you've successfully resolved this issue or if you need further help?&lt;BR /&gt;If you've already resolved the issue, you can mark the helpful reply as a "solution" so others know that the question has been answered and help other people in the community. Thank you again for your cooperation!&lt;BR /&gt;If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;SPAN data-teams="true"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Regards,&lt;BR /&gt;Sahasra.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 10:09:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4338447#M172264</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2024-12-20T10:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic 2 Date Columns Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4340782#M172371</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="902274" data-lia-user-login="sammy339" class="lia-mention lia-mention-user"&gt;sammy339&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;May I ask if you have gotten this issue resolved?&lt;/P&gt;
&lt;P&gt;If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 11:45:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4340782#M172371</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2024-12-23T11:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic 2 Date Columns Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4344489#M172515</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="902274" data-lia-user-login="sammy339" class="lia-mention lia-mention-user"&gt;sammy339&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;I wanted to check in on your situation regarding the issue. Have you resolved it? If you have, please consider marking the reply that helped you or sharing your solution. It would be greatly appreciated by others in the community who may have the same question.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Regards,&lt;BR /&gt;Sahasra.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 09:41:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-2-Date-Columns-Difference/m-p/4344489#M172515</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2024-12-27T09:41:21Z</dc:date>
    </item>
  </channel>
</rss>

