<?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 Function to get a value to be used in a filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3041256#M104328</link>
    <description>&lt;P&gt;Hi everyone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have barely used Power BI before, I mostly work with Automate and Power Apps. Now, using the new Power BI connector in Flow, I need to get a table composed of columns from many tables in the dataset as a JSON. I've been analyzing the relations between tables in the dataset and I think I have worked on how to do it; I hope to use the SelectColumns function and with the Related functions, get the columns values I need from tables different to the one I'm basing the query on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'm a little stuck with how to get a filter to work. I suppose this may be pretty easy, but any help is apreciated. The user is going to enter a code in a search bar. That code is going to be used to get a single row in a "Codes" table, which happen to have also a "key" columns. That "key" column is going to be used to get a single row in the "Data" table, the table I'll use as the base to get my JSON built in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is: how can I get the "key" column as a scalar value to filter the "Data" column based on it, if I feed it the "code" column? I may be thinking too off Power BI, maybe, so if there is an easy way to do it, I'm fully open to try &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope the question is clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pd: I've researched about the Filter functions, but there does not seem to be something like table.value, to get a value from a table...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pd2: Would this be a good way to do it?:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Data,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Data[Key] = &lt;/SPAN&gt;&lt;SPAN&gt;LOOKUPVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(Codes[Key],Codes[Code],STRING_ENTERED_BY_USER&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2023 21:30:17 GMT</pubDate>
    <dc:creator>leandro_vegacr</dc:creator>
    <dc:date>2023-01-24T21:30:17Z</dc:date>
    <item>
      <title>Function to get a value to be used in a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3041256#M104328</link>
      <description>&lt;P&gt;Hi everyone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have barely used Power BI before, I mostly work with Automate and Power Apps. Now, using the new Power BI connector in Flow, I need to get a table composed of columns from many tables in the dataset as a JSON. I've been analyzing the relations between tables in the dataset and I think I have worked on how to do it; I hope to use the SelectColumns function and with the Related functions, get the columns values I need from tables different to the one I'm basing the query on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'm a little stuck with how to get a filter to work. I suppose this may be pretty easy, but any help is apreciated. The user is going to enter a code in a search bar. That code is going to be used to get a single row in a "Codes" table, which happen to have also a "key" columns. That "key" column is going to be used to get a single row in the "Data" table, the table I'll use as the base to get my JSON built in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is: how can I get the "key" column as a scalar value to filter the "Data" column based on it, if I feed it the "code" column? I may be thinking too off Power BI, maybe, so if there is an easy way to do it, I'm fully open to try &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope the question is clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pd: I've researched about the Filter functions, but there does not seem to be something like table.value, to get a value from a table...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pd2: Would this be a good way to do it?:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Data,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Data[Key] = &lt;/SPAN&gt;&lt;SPAN&gt;LOOKUPVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(Codes[Key],Codes[Code],STRING_ENTERED_BY_USER&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 21:30:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3041256#M104328</guid>
      <dc:creator>leandro_vegacr</dc:creator>
      <dc:date>2023-01-24T21:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Function to get a value to be used in a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3042268#M104409</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="433320" data-lia-user-login="leandro_vegacr" class="lia-mention lia-mention-user"&gt;leandro_vegacr&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please provide a snapshot of the relevant&amp;nbsp;part of your data model along with the relationships and sample expected result.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 10:15:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3042268#M104409</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-25T10:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Function to get a value to be used in a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3042720#M104442</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;, pleased to!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PedidosJDEQuery is the point of access to the app, there is a pedidosJDE field that is the input the requester is going to provide.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From there, there is a field called chaveApp that relates with pedidosJDEDirect table, and that I need to use to filter pedidosJDEDirect table. which is going to be the base table. &lt;STRONG&gt;Again, I need to build a new table with fields from all the tables related with PedidosJDE_Direct.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now I have a working query, taking advantage of all the related tables. It is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EVALUATE(&lt;BR /&gt;SELECTCOLUMNS(&lt;BR /&gt;Filter(&lt;BR /&gt;PedidosJDE_Direct,&lt;BR /&gt;PedidosJDE_Direct[CHAVEAPP] = LOOKUPVALUE(PedidosAppComPedidoJDE[ChaveApp],PedidosAppComPedidoJDE[PedidoJDE],&lt;EM&gt;USER_INPUT&lt;/EM&gt;)&lt;BR /&gt;),&lt;BR /&gt;"Regional", RELATED(PedidosAppComPedidoJDE[Regional]),&lt;BR /&gt;"Subregional", Related(Clientes[subarea_name]),&lt;BR /&gt;"CD_Clientes", PedidosJDE_Direct[TP PEDIDO],&lt;BR /&gt;"CPF_Cliente", RELATED(Clientes[farmer_cnpj_cpf]),&lt;BR /&gt;"Inscricao_estadual",RELATED(Fazendas[IE]),&lt;BR /&gt;"Address_fazenda",RELATED(Fazendas[ADDRESS]),&lt;BR /&gt;"Fazenda",RELATED(Fazendas[NOME]),&lt;BR /&gt;"Municipio_fazenda",RELATED(Fazendas[CIDADE]),&lt;BR /&gt;"UF_fazenda",RELATED(Fazendas[UF]),&lt;BR /&gt;"Frete", PedidosJDE_Direct[TP FRETE],&lt;BR /&gt;"Data_inicio_entrega",PedidosJDE_Direct[INICIO ENTREGA],&lt;BR /&gt;"Data_fin_entrega",PedidosJDE_Direct[FINAL ENTREGA],&lt;BR /&gt;"Vendedor",RELATED(Clientes[responsible_user_name]),&lt;BR /&gt;"Grupo_item",PedidosJDE_Direct[GRUPO]&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for taking a look.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 13:28:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3042720#M104442</guid>
      <dc:creator>leandro_vegacr</dc:creator>
      <dc:date>2023-01-25T13:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Function to get a value to be used in a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3042879#M104451</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="433320" data-lia-user-login="leandro_vegacr" class="lia-mention lia-mention-user"&gt;leandro_vegacr&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Nothing is wrong with your code except that I don't trust LOOKUPVALUE as it might generate errors depending on the selection and the possibility of blank values inside the table.&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;'PedidosAppComPedidoJDE' table filters 'PedidosJDE_Direct' table therefore, you can use CALCULATETABLE instead of FILTER as follows&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;=
CALCULATETABLE (
    PedidosJDE_Direct,
    PedidosAppComPedidoJDE[PedidoJDE] = USER_INPUT
)&lt;/LI-CODE&gt;
&lt;P&gt;Other than that, the SELECTCOLUMNS function is perfectly used in its place.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 14:19:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3042879#M104451</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-25T14:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Function to get a value to be used in a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3043641#M104550</link>
      <description>&lt;P&gt;Cool, thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 19:26:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Function-to-get-a-value-to-be-used-in-a-filter/m-p/3043641#M104550</guid>
      <dc:creator>leandro_vegacr</dc:creator>
      <dc:date>2023-01-25T19:26:44Z</dc:date>
    </item>
  </channel>
</rss>

