<?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: Using list of values in IN function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-list-of-values-in-IN-function/m-p/3658006#M141738</link>
    <description>&lt;P&gt;This is a dilemma.&amp;nbsp; The SWITCH statement cannot return objects, only simple data types.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to refactor the query to pull the switch into the final step, or use SEARCH&amp;nbsp; instead with a string concatenation of your match terms.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jan 2024 20:00:50 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-01-24T20:00:50Z</dc:date>
    <item>
      <title>Using list of values in IN function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-list-of-values-in-IN-function/m-p/3657679#M141719</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have the following measure:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Status = 
VAR _Series_Month =
    LEFT(MAX(all_series[series]), SEARCH(" ", MAX(all_series[series])) - 1)

VAR _Key_Markets =
    SWITCH(
        _Series_Month,
        "March", 
            {"Country1"},
        "June", 
            {"Country2", "Country3", "Country4"},
        "November", 
            {"Country5", "Country6"},
        BLANK()
    )

VAR _Key_Market_Q =
    CALCULATE(
        MAX(key_Customer_Entries[Q%]),
        key_Customer_Entries[country] IN _Key_Markets,
        key_Customer_Entries[ses_name] = MAX(all_series[series])
    )

RETURN 
    _Key_Market_Q&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I keep getting the following error:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The function expects a table expression for argument '', but a string or numeric expression was used.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;How do I pass the values from _Key_Markets into _Key_Market_Q correctly?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 16:58:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-list-of-values-in-IN-function/m-p/3657679#M141719</guid>
      <dc:creator>RyanHare92</dc:creator>
      <dc:date>2024-01-24T16:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using list of values in IN function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-list-of-values-in-IN-function/m-p/3658006#M141738</link>
      <description>&lt;P&gt;This is a dilemma.&amp;nbsp; The SWITCH statement cannot return objects, only simple data types.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to refactor the query to pull the switch into the final step, or use SEARCH&amp;nbsp; instead with a string concatenation of your match terms.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 20:00:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-list-of-values-in-IN-function/m-p/3658006#M141738</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-01-24T20:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using list of values in IN function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-list-of-values-in-IN-function/m-p/3659731#M141810</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="510880" data-lia-user-login="RyanHare92" class="lia-mention lia-mention-user"&gt;RyanHare92&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You can follow the steps to get it:&lt;/P&gt;
&lt;P&gt;1. Create a dimension table as below&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. Update the formula of your measure[Status] as below&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Status =
VAR _Series_Month =
    LEFT (
        MAX ( all_series[series] ),
        SEARCH ( " ", MAX ( all_series[series] ) ) - 1
    )
VAR _Key_Markets =
    CALCULATETABLE (
        VALUES ( 'Table'[Countries] ),
        FILTER ( 'Table', 'Table'[Month] = _Series_Month )
    )
VAR _Key_Market_Q =
    CALCULATE (
        MAX ( key_Customer_Entries[Q%] ),
        key_Customer_Entries[country] IN _Key_Markets,
        key_Customer_Entries[ses_name] = MAX ( all_series[series] )
    )
RETURN
    _Key_Market_Q&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;If the above one can't help you get the expected result, please provide some&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;raw data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;in your tables (&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;) with&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with special examples and screenshots.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;It would be helpful to find out the solution. You can refer the following link to share the required info:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-provide-sample-data-in-the-Power-BI-Forum%2Fba-p%2F963216&amp;amp;data=05%7C01%7CClaire.Dong%40microsoft.com%7Cada9149bd91546a8432508dacd31ef9b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638047911607737134%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=EJlYfclgtrjgAEYj9Uo1AauqxaQm3hlQsjJMo4zCY1M%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;pbix file. You can refer the following link to upload the file to the community. Thank you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FDesktop%2FHow-to-upload-PBI-in-Community%2Fm-p%2F1672886&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C4f580813734d4a8355b008da16f6e91a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637847547341062885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=YJvujige2YITXKbKED9JieQm5LBdf%2F3IYPM4ggdiijQ%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to upload PBI in Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 09:56:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-list-of-values-in-IN-function/m-p/3659731#M141810</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-25T09:56:20Z</dc:date>
    </item>
  </channel>
</rss>

