<?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: Getting a columns value comprises between two column values of another table in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2590109#M78956</link>
    <description>&lt;P&gt;If you can post sample tables here and explain the problem with respect to those tables, giving solution will be easier.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jun 2022 16:20:16 GMT</pubDate>
    <dc:creator>Vijay_A_Verma</dc:creator>
    <dc:date>2022-06-20T16:20:16Z</dc:date>
    <item>
      <title>Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2590077#M78955</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;inside a PQ query I've two tables, A and B.&lt;/P&gt;&lt;P&gt;Inside the table A I need to add a custom column with the ID of the table B when a certain column of the table A is comprised between the values of two columns of the table B.&lt;BR /&gt;I think to use&amp;nbsp;Table.SelectRows and Table.SelectColumns for the custom column to add to table A, but I've a syntax error&lt;BR /&gt;when I refer to the column of the table A (e.g. A.[column_to_match]).&lt;/P&gt;&lt;P&gt;Perhaps, I need to use another formulas.&lt;/P&gt;&lt;P&gt;Any suggests to me, please? Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 15:57:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2590077#M78955</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-20T15:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2590109#M78956</link>
      <description>&lt;P&gt;If you can post sample tables here and explain the problem with respect to those tables, giving solution will be easier.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 16:20:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2590109#M78956</guid>
      <dc:creator>Vijay_A_Verma</dc:creator>
      <dc:date>2022-06-20T16:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2591487#M79007</link>
      <description>&lt;P&gt;The&amp;nbsp;Employee_times table is the A table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Employee_name&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;20/06/2022&lt;/TD&gt;&lt;TD&gt;09:15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;20/06/2022&lt;/TD&gt;&lt;TD&gt;14:05&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;21/06/2022&lt;/TD&gt;&lt;TD&gt;09:05&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Time_ranges table is the B table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Range_ID&lt;/TD&gt;&lt;TD&gt;Start_time&lt;/TD&gt;&lt;TD&gt;End_time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;08:30&lt;/TD&gt;&lt;TD&gt;09:30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;13:30&lt;/TD&gt;&lt;TD&gt;14:30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to add to the&amp;nbsp;Employee_times table the Range_ID custom column in order to produce a such situation (I need to detect the Range_ID value inside the&amp;nbsp;Time_ranges table checking that Start_time &amp;lt;= Time &amp;lt;= End_time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Employee_name&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Time&lt;/TD&gt;&lt;TD&gt;Range_ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;20/06/2022&lt;/TD&gt;&lt;TD&gt;09:15&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;20/06/2022&lt;/TD&gt;&lt;TD&gt;14:05&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;21/06/2022&lt;/TD&gt;&lt;TD&gt;09:05&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 07:59:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2591487#M79007</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-21T07:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2591690#M79017</link>
      <description>&lt;P&gt;Use this formula in a custom column&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= Table.SelectRows(Time_ranges, (x)=&amp;gt; x[Start_time]&amp;lt;=[Time] and x[End_time]&amp;gt;=[Time]){0}[Range_ID]&lt;/LI-CODE&gt;&lt;P&gt;See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfLKz8gDUkYG+gZm+kYGRkZAjoGllaGpUqxOtJIRDhWGJlYGEBXGSCoMUc0AqYgFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Employee_name = _t, Date = _t, Time = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Employee_name", type text}, {"Date", type text}, {"Time", type time}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Range_ID", each Table.SelectRows(Time_ranges, (x)=&amp;gt; x[Start_time]&amp;lt;=[Time] and x[End_time]&amp;gt;=[Time]){0}[Range_ID], type number)
in
    #"Added Custom"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Jun 2022 08:53:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2591690#M79017</guid>
      <dc:creator>Vijay_A_Verma</dc:creator>
      <dc:date>2022-06-21T08:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2591877#M79023</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've obtained this error message:&lt;/P&gt;&lt;P&gt;There are not enough elements in the enumeration to complete the operation.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 09:42:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2591877#M79023</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-21T09:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2591951#M79029</link>
      <description>&lt;P&gt;Give me your complete query if you are using your own query.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 09:59:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2591951#M79029</guid>
      <dc:creator>Vijay_A_Verma</dc:creator>
      <dc:date>2022-06-21T09:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2592003#M79031</link>
      <description>&lt;LI-CODE lang="markup"&gt;let
    Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDTByIjAyMjJR0lYyAOyCwoyAfShgZWBgZKsTr4lBhjVWICUpJTWgJWYghWEgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Data = _t, ID_badge = _t, Impiegato = _t, Ora = _t]),
    #"Modificato tipo" = Table.TransformColumnTypes(Origine,{{"Data", type date}, {"ID_badge", Int64.Type}, {"Impiegato", type text}, {"Ora", type time}}),
    #"Aggiunta colonna personalizzata" = Table.AddColumn(#"Modificato tipo", "Personalizzato", each Table.SelectRows(Fasce_orari, (x)=&amp;gt; x[Ora_min]&amp;lt;=[Ora] and x[Ora_max]&amp;gt;=[Ora]){0}[ID_fascia])
in
    #"Aggiunta colonna personalizzata"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Jun 2022 10:12:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2592003#M79031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-21T10:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2592168#M79043</link>
      <description>&lt;P&gt;Since, none of your time are in the range, hence there are no results, hence Error. I will be displaying null in this case. Use this in the Custom column&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= try Table.SelectRows(Fasce_orari, (x)=&amp;gt; x[Ora_min]&amp;lt;=[Ora] and x[Ora_max]&amp;gt;=[Ora]){0}[ID_fascia] otherwise null&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Hence, your complete query will become&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDTByIjAyMjJR0lYyAOyCwoyAfShgZWBgZKsTr4lBhjVWICUpJTWgJWYghWEgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Data = _t, ID_badge = _t, Impiegato = _t, Ora = _t]),
    #"Modificato tipo" = Table.TransformColumnTypes(Origine,{{"Data", type date}, {"ID_badge", Int64.Type}, {"Impiegato", type text}, {"Ora", type time}}),
    #"Aggiunta colonna personalizzata" = Table.AddColumn(#"Modificato tipo", "Personalizzato", each try Table.SelectRows(Fasce_orari, (x)=&amp;gt; x[Ora_min]&amp;lt;=[Ora] and x[Ora_max]&amp;gt;=[Ora]){0}[ID_fascia] otherwise null)
in
    #"Aggiunta colonna personalizzata"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Jun 2022 12:05:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2592168#M79043</guid>
      <dc:creator>Vijay_A_Verma</dc:creator>
      <dc:date>2022-06-21T12:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2592174#M79044</link>
      <description>&lt;P&gt;All times are in a range, e.g. 09:15 is between 08:30 and 09:30.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 12:08:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2592174#M79044</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-21T12:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2592237#M79049</link>
      <description>&lt;P&gt;The query which you have given to me has following times and none of them are in the range&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 12:30:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2592237#M79049</guid>
      <dc:creator>Vijay_A_Verma</dc:creator>
      <dc:date>2022-06-21T12:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2596672#M79221</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've posted a Employee_time table with the corresponding values.&lt;/P&gt;&lt;P&gt;I've solved with this function:&lt;/P&gt;&lt;P&gt;(Valore_ora) =&amp;gt;&lt;BR /&gt;let Origine = Fasce_orari,&lt;BR /&gt;#"Filtra righe" = Table.First(Table.SelectRows(Origine, each [Ora_min] &amp;lt;= Valore_ora and [Ora_max] &amp;gt;= Valore_ora)),&lt;BR /&gt;#"Fascia" = try Record.Field(#"Filtra righe", "Fascia") otherwise null&lt;BR /&gt;in #"Fascia"&lt;BR /&gt;&lt;BR /&gt;In my employee time table in order to add a new custom column I've invoked the above custom function. I need to get the specific field after the Table.SelectRows statement.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 07:06:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2596672#M79221</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-23T07:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a columns value comprises between two column values of another table</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2596810#M79225</link>
      <description>&lt;P&gt;Great!!! You can use a single statement by merging last two into one.&lt;/P&gt;&lt;P&gt;Table.SelectRows(Origine, each [Ora_min] &amp;lt;= Valore_ora and [Ora_max] &amp;gt;= Valore_ora){0}[Fascia]&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 07:46:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Getting-a-columns-value-comprises-between-two-column-values-of/m-p/2596810#M79225</guid>
      <dc:creator>Vijay_A_Verma</dc:creator>
      <dc:date>2022-06-23T07:46:03Z</dc:date>
    </item>
  </channel>
</rss>

