<?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: Creating Column/Measure depending on variables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-Column-Measure-depending-on-variables/m-p/2275610#M55535</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="312802" data-lia-user-login="Samarth_18" class="lia-mention lia-mention-user"&gt;Samarth_18&lt;/a&gt;&amp;nbsp; Thank you very much and should I change it when e.g. Date2 is from another table? I should write the code differently, right?&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jan 2022 14:54:14 GMT</pubDate>
    <dc:creator>Nini1</dc:creator>
    <dc:date>2022-01-10T14:54:14Z</dc:date>
    <item>
      <title>Creating Column/Measure depending on variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-Column-Measure-depending-on-variables/m-p/2275508#M55531</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not been a long time I'm using Power Bi and need your help to solve this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following&amp;nbsp; data&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;ID2&lt;/TD&gt;&lt;TD&gt;Date1&lt;/TD&gt;&lt;TD&gt;Date2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;9/29/2021&lt;/TD&gt;&lt;TD&gt;10/30/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;9/30/2021&lt;/TD&gt;&lt;TD&gt;10/30/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;10/5/2021&lt;/TD&gt;&lt;TD&gt;10/30/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;10/5/2021&lt;/TD&gt;&lt;TD&gt;11/15/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;10/8/2021&lt;/TD&gt;&lt;TD&gt;11/15/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;11/2/2021&lt;/TD&gt;&lt;TD&gt;11/15/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;1/31/2021&lt;/TD&gt;&lt;TD&gt;5/1/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;TD&gt;2/2/2021&lt;/TD&gt;&lt;TD&gt;5/1/2021&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a column which will be equal to date2 but in specific time period - values that are more then min value of date1 and less than max value of date1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To clarify, I tried with the formula below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Time Period = 
VAR MIN_P_ = MIN('Tbl'[Date1])
VAR MAX_P_ = MAX('Tbl'[Date1])
VAR Time_Per = MIN_P_&amp;lt;='Tbl'[Date2]&amp;lt;= MAX_P_
return Time_Per&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Just this does not work,it gives me this error:&amp;nbsp;DAX comparison operations do not support comparing values of type True/False with values of type Date. Consider using the VALUE or FORMAT function to convert one of the values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help to transform and adjust the formula above so that I could get a desired result?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 14:14:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-Column-Measure-depending-on-variables/m-p/2275508#M55531</guid>
      <dc:creator>Nini1</dc:creator>
      <dc:date>2022-01-10T14:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Column/Measure depending on variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-Column-Measure-depending-on-variables/m-p/2275538#M55532</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="347777" data-lia-user-login="Nini1" class="lia-mention lia-mention-user"&gt;Nini1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try below code:-&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Time Period =
VAR MIN_P_ =
    CALCULATE ( MIN ( 'Dates_range'[Date1] ), ALL ( Dates_range ) )
VAR MAX_P_ =
    CALCULATE ( MAX ( 'Dates_range'[Date1] ), ALL ( Dates_range ) )
VAR Time_Per =
    IF (
        AND ( 'Dates_range'[Date2] &amp;gt;= MIN_P_, 'Dates_range'[Date2] &amp;lt;= MAX_P_ ),
        Dates_range[Date2]
    )
RETURN
    Time_Per&lt;/LI-CODE&gt;&lt;P&gt;Ouput:-&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Samarth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 14:25:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-Column-Measure-depending-on-variables/m-p/2275538#M55532</guid>
      <dc:creator>Samarth_18</dc:creator>
      <dc:date>2022-01-10T14:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Column/Measure depending on variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-Column-Measure-depending-on-variables/m-p/2275610#M55535</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="312802" data-lia-user-login="Samarth_18" class="lia-mention lia-mention-user"&gt;Samarth_18&lt;/a&gt;&amp;nbsp; Thank you very much and should I change it when e.g. Date2 is from another table? I should write the code differently, right?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 14:54:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-Column-Measure-depending-on-variables/m-p/2275610#M55535</guid>
      <dc:creator>Nini1</dc:creator>
      <dc:date>2022-01-10T14:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Column/Measure depending on variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-Column-Measure-depending-on-variables/m-p/2275621#M55537</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="347777" data-lia-user-login="Nini1" class="lia-mention lia-mention-user"&gt;Nini1&lt;/a&gt;&amp;nbsp;I think it should work in that case as well.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:00:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-Column-Measure-depending-on-variables/m-p/2275621#M55537</guid>
      <dc:creator>Samarth_18</dc:creator>
      <dc:date>2022-01-10T15:00:39Z</dc:date>
    </item>
  </channel>
</rss>

