<?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: LOOKUP with conditions in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUP-with-conditions/m-p/4338499#M172268</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="904007" data-lia-user-login="NMC20" class="lia-mention lia-mention-user"&gt;NMC20&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Go to the "All Payment Data" table in Power BI.&lt;/LI&gt;&lt;LI&gt;Create a new calculated column by clicking on the &lt;STRONG&gt;Modeling&lt;/STRONG&gt; tab and selecting &lt;STRONG&gt;New Column&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;Use the following DAX formula:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;% Revenue =
VAR InstallationDate = RELATED('Sites Information'[Installation Date])
VAR ThreeMonthsDate = RELATED('Sites Information'[3 months date])
VAR First3MonthsPercentage = RELATED('Sites Information'[% first 3 months])
VAR After3MonthsPercentage = RELATED('Sites Information'[% after 3 months])
RETURN
    IF(
        [Date of Order] &amp;gt;= InstallationDate &amp;amp;&amp;amp; [Date of Order] &amp;lt; ThreeMonthsDate,
        First3MonthsPercentage,
        IF(
            [Date of Order] &amp;gt;= ThreeMonthsDate,
            After3MonthsPercentage,
            BLANK() -- Or use 0 or any default value if needed
        )
    )
​&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Assuming&lt;/STRONG&gt; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Your "Sites Information" and "All Payment Data" tables are correctly related via the [Location] column in a one-to-many relationship.&lt;/LI&gt;&lt;LI&gt;The date fields in both tables are in a valid date format.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution, this will help others!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If my response(s) assisted you in any way, don't forget to drop me a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Poojara&lt;BR /&gt;Data Analyst | MSBI Developer | Power BI Consultant&lt;BR /&gt;&lt;STRONG&gt;Consider Subscribing my YouTube for Beginners/Advance Concepts:&lt;/STRONG&gt;&amp;nbsp;&lt;A href="https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS" target="_self"&gt;https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Dec 2024 10:35:03 GMT</pubDate>
    <dc:creator>Poojara_D12</dc:creator>
    <dc:date>2024-12-20T10:35:03Z</dc:date>
    <item>
      <title>LOOKUP with conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUP-with-conditions/m-p/4338446#M172263</link>
      <description>&lt;P&gt;I have two tables and I would like a lookup from one to the other based on a condition.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a "Sites Information" table which shows me [Location] [Installation Date] [% first 3 months] [3 months date] [% after 3 months] per venue we have&lt;/P&gt;&lt;P&gt;I have an "All Payment Data" table which has the [Location] and [Date of Order] and provides individual orders taken and which site this can be attributed to&lt;/P&gt;&lt;P&gt;I've managed to do a simple lookup between [Location] to bring back all of the fields in "Sites Information" in "All Payment Data". However, I would like a column in "All Payment Data" which tells me what % revenue from each order should be going to the venue based on the date of the order:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If [Date of Order] is (&amp;gt;= [Installation Date] and &amp;lt; [3 months date]) then [% first 3 months]&lt;/P&gt;&lt;P&gt;If [Date of Order] is &amp;gt;= [3 months date] then [% after 3 months]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone advise? Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 10:08:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUP-with-conditions/m-p/4338446#M172263</guid>
      <dc:creator>NMC20</dc:creator>
      <dc:date>2024-12-20T10:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: LOOKUP with conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUP-with-conditions/m-p/4338499#M172268</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="904007" data-lia-user-login="NMC20" class="lia-mention lia-mention-user"&gt;NMC20&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Go to the "All Payment Data" table in Power BI.&lt;/LI&gt;&lt;LI&gt;Create a new calculated column by clicking on the &lt;STRONG&gt;Modeling&lt;/STRONG&gt; tab and selecting &lt;STRONG&gt;New Column&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;Use the following DAX formula:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;% Revenue =
VAR InstallationDate = RELATED('Sites Information'[Installation Date])
VAR ThreeMonthsDate = RELATED('Sites Information'[3 months date])
VAR First3MonthsPercentage = RELATED('Sites Information'[% first 3 months])
VAR After3MonthsPercentage = RELATED('Sites Information'[% after 3 months])
RETURN
    IF(
        [Date of Order] &amp;gt;= InstallationDate &amp;amp;&amp;amp; [Date of Order] &amp;lt; ThreeMonthsDate,
        First3MonthsPercentage,
        IF(
            [Date of Order] &amp;gt;= ThreeMonthsDate,
            After3MonthsPercentage,
            BLANK() -- Or use 0 or any default value if needed
        )
    )
​&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Assuming&lt;/STRONG&gt; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Your "Sites Information" and "All Payment Data" tables are correctly related via the [Location] column in a one-to-many relationship.&lt;/LI&gt;&lt;LI&gt;The date fields in both tables are in a valid date format.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution, this will help others!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If my response(s) assisted you in any way, don't forget to drop me a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Poojara&lt;BR /&gt;Data Analyst | MSBI Developer | Power BI Consultant&lt;BR /&gt;&lt;STRONG&gt;Consider Subscribing my YouTube for Beginners/Advance Concepts:&lt;/STRONG&gt;&amp;nbsp;&lt;A href="https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS" target="_self"&gt;https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 10:35:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUP-with-conditions/m-p/4338499#M172268</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2024-12-20T10:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: LOOKUP with conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUP-with-conditions/m-p/4338689#M172280</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="904007" data-lia-user-login="NMC20" class="lia-mention lia-mention-user"&gt;NMC20&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create new column&amp;nbsp;in the "All Payment Data" table:&lt;/P&gt;&lt;PRE&gt;Revenue Percentage = &lt;BR /&gt;IF(&lt;BR /&gt;'All Payment Data'[Date of Order] &amp;gt;= RELATED('Sites Information'[Installation Date]) &amp;amp;&amp;amp;&lt;BR /&gt;'All Payment Data'[Date of Order] &amp;lt; RELATED('Sites Information'[3 months date]),&lt;BR /&gt;RELATED('Sites Information'[% first 3 months]),&lt;BR /&gt;IF(&lt;BR /&gt;'All Payment Data'[Date of Order] &amp;gt;= RELATED('Sites Information'[3 months date]),&lt;BR /&gt;RELATED('Sites Information'[% after 3 months]),&lt;BR /&gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":love_letter:"&gt;💌&lt;/span&gt; &lt;STRONG&gt;If this helped, a Kudos &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; or Solution mark &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; would be great! &lt;span class="lia-unicode-emoji" title=":party_popper:"&gt;🎉&lt;/span&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Cheers,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Kedar&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;A href="https://www.linkedin.com/in/kedar-pande" target="_blank" rel="noopener"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 12:36:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUP-with-conditions/m-p/4338689#M172280</guid>
      <dc:creator>Kedar_Pande</dc:creator>
      <dc:date>2024-12-20T12:36:36Z</dc:date>
    </item>
  </channel>
</rss>

