<?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: Sub String lookup for Multiple Values contained in a cell. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sub-String-lookup-for-Multiple-Values-contained-in-a-cell/m-p/3299056#M122961</link>
    <description>&lt;P&gt;Let's solve this in the query.&lt;/P&gt;
&lt;P&gt;Take the second query, use a function to seperate the "approved by" list into rows.&lt;/P&gt;
&lt;P&gt;Then&amp;nbsp;inner join this table with the users table.&lt;/P&gt;
&lt;P&gt;In SQL, this can be:&lt;/P&gt;
&lt;P&gt;Now, inner join this table with the users table.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;WITH _List AS
(
SELECT [ID], value AS [Approved By]
FROM [YourTable]
CROSS APPLY STRING_SPLIT([Approved By], ',')
),

_Valid_Approvers AS
(
SELECT
_List.ID,
COUNT(*) AS Approvers_Count
FROM _List
INNER JOIN [ApproversTable] AT
ON AT.Approver = _List.Approver
GROUP BY _List.ID
)

SELECT
[YourTable].*,
CASE
WHEN VA.Approvers_Count IS NULL THEN 'No',
ELSE 'YES'
END AS Has_Valid_Approvers
FROM [YourTable] C
LEFT JOIN _Valid_Approvers VA
ON C.[ID] = VA.[ID]
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jun 2023 03:38:52 GMT</pubDate>
    <dc:creator>rbriga</dc:creator>
    <dc:date>2023-06-23T03:38:52Z</dc:date>
    <item>
      <title>Sub String lookup for Multiple Values contained in a cell.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sub-String-lookup-for-Multiple-Values-contained-in-a-cell/m-p/3298689#M122951</link>
      <description>&lt;P&gt;I have two queries.&amp;nbsp; One query contains a list of users with one value (Approved by) per row.&amp;nbsp; I have another query that lists more than one value in the cell (Approvers).&amp;nbsp; The values are separated by a delimiter.&amp;nbsp; I want to look up to see if the Approved By is listed in the Approver report, with a simple yes no result.&amp;nbsp; For example, if this was excel it would be IF(Approver By = "*"Approver"*", "Yes","No")&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 22:13:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sub-String-lookup-for-Multiple-Values-contained-in-a-cell/m-p/3298689#M122951</guid>
      <dc:creator>KeithSP</dc:creator>
      <dc:date>2023-06-22T22:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Sub String lookup for Multiple Values contained in a cell.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sub-String-lookup-for-Multiple-Values-contained-in-a-cell/m-p/3299056#M122961</link>
      <description>&lt;P&gt;Let's solve this in the query.&lt;/P&gt;
&lt;P&gt;Take the second query, use a function to seperate the "approved by" list into rows.&lt;/P&gt;
&lt;P&gt;Then&amp;nbsp;inner join this table with the users table.&lt;/P&gt;
&lt;P&gt;In SQL, this can be:&lt;/P&gt;
&lt;P&gt;Now, inner join this table with the users table.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;WITH _List AS
(
SELECT [ID], value AS [Approved By]
FROM [YourTable]
CROSS APPLY STRING_SPLIT([Approved By], ',')
),

_Valid_Approvers AS
(
SELECT
_List.ID,
COUNT(*) AS Approvers_Count
FROM _List
INNER JOIN [ApproversTable] AT
ON AT.Approver = _List.Approver
GROUP BY _List.ID
)

SELECT
[YourTable].*,
CASE
WHEN VA.Approvers_Count IS NULL THEN 'No',
ELSE 'YES'
END AS Has_Valid_Approvers
FROM [YourTable] C
LEFT JOIN _Valid_Approvers VA
ON C.[ID] = VA.[ID]
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 03:38:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sub-String-lookup-for-Multiple-Values-contained-in-a-cell/m-p/3299056#M122961</guid>
      <dc:creator>rbriga</dc:creator>
      <dc:date>2023-06-23T03:38:52Z</dc:date>
    </item>
  </channel>
</rss>

