<?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 Filtering Table Based On Measure Value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-Based-On-Measure-Value/m-p/831924#M6036</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running into some issues while trying to parameterize a query in Power BI Report Builder. For the parameters, I need to be able to select multiple values so I can't use conventional filter expressions like Filter(&amp;lt;Table&amp;gt;,[Field]="LookupValue"). I've found how to get this to work for columns that exist in the raw data but am having trouble with values calculated from measures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the relevant code that I'm attempting to use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR StatusCount =
    PATHLENGTH ( @ProjStatus)
VAR StatusNumberTable =
    GENERATESERIES ( 1, StatusCount, 1 )
VAR StatusTable =
    GENERATE (
        StatusNumberTable,
        VAR StatusCurrentKey = [Value]
        RETURN
            ROW ( "Key", PATHITEM ( @ProjStatus,StatusCurrentKey ) )
    )
VAR GetKeyStatusColumn =
    SELECTCOLUMNS ( StatusTable, "Key", [Key] )

  VAR __DS0Core = 
    SUMMARIZECOLUMNS(
      'Projects'[Project Name],
      "WorstStatus", 'Meta_EngStatusSummary'[WorstStatus]
    )

EVALUATE
 CALCULATETABLE( __DS0Core,INTERSECT( SELECTCOLUMNS ( __DS0Core, "Key", [WorstStatus] ) , GetKeyStatusColumn))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[WorstStatus] is a measure with possible values "Green", "Yellow", and "Red" FWIW.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first 4 variables are used to convert the input string ("Green|Yellow") to a single-column table (GetKeyStatusColumn) which I'm trying to use to filter __DS0Core. The issue that I'm running into is that CALCULATETABLE is not filtering __DS0Core based on the filter applied. I'm trying to mimic the approach used here:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Desktop/Filter-table-based-on-another-table/m-p/519101/highlight/false#M242748" target="_self"&gt;https://community.powerbi.com/t5/Desktop/Filter-table-based-on-another-table/m-p/519101/highlight/false#M242748&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the values of GetKeyStatusColumn and the SELECTCOLUMNS that I'm using to pull the WorstStatus column, both tables appear correctly/as expected on their own. I believe the issue is that the SELECTCOLUMNS breaks the relationship between it and __DS0Core, but I may be wrong. When trying to use [WorstStatus] directly without SELECTCOLUMNS, an error is thrown that it is not a table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions on how to try to correct this or another approach to test would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks ahead of time.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2019 01:09:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-10-30T01:09:04Z</dc:date>
    <item>
      <title>Filtering Table Based On Measure Value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-Based-On-Measure-Value/m-p/831924#M6036</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running into some issues while trying to parameterize a query in Power BI Report Builder. For the parameters, I need to be able to select multiple values so I can't use conventional filter expressions like Filter(&amp;lt;Table&amp;gt;,[Field]="LookupValue"). I've found how to get this to work for columns that exist in the raw data but am having trouble with values calculated from measures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the relevant code that I'm attempting to use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR StatusCount =
    PATHLENGTH ( @ProjStatus)
VAR StatusNumberTable =
    GENERATESERIES ( 1, StatusCount, 1 )
VAR StatusTable =
    GENERATE (
        StatusNumberTable,
        VAR StatusCurrentKey = [Value]
        RETURN
            ROW ( "Key", PATHITEM ( @ProjStatus,StatusCurrentKey ) )
    )
VAR GetKeyStatusColumn =
    SELECTCOLUMNS ( StatusTable, "Key", [Key] )

  VAR __DS0Core = 
    SUMMARIZECOLUMNS(
      'Projects'[Project Name],
      "WorstStatus", 'Meta_EngStatusSummary'[WorstStatus]
    )

EVALUATE
 CALCULATETABLE( __DS0Core,INTERSECT( SELECTCOLUMNS ( __DS0Core, "Key", [WorstStatus] ) , GetKeyStatusColumn))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[WorstStatus] is a measure with possible values "Green", "Yellow", and "Red" FWIW.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first 4 variables are used to convert the input string ("Green|Yellow") to a single-column table (GetKeyStatusColumn) which I'm trying to use to filter __DS0Core. The issue that I'm running into is that CALCULATETABLE is not filtering __DS0Core based on the filter applied. I'm trying to mimic the approach used here:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Desktop/Filter-table-based-on-another-table/m-p/519101/highlight/false#M242748" target="_self"&gt;https://community.powerbi.com/t5/Desktop/Filter-table-based-on-another-table/m-p/519101/highlight/false#M242748&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the values of GetKeyStatusColumn and the SELECTCOLUMNS that I'm using to pull the WorstStatus column, both tables appear correctly/as expected on their own. I believe the issue is that the SELECTCOLUMNS breaks the relationship between it and __DS0Core, but I may be wrong. When trying to use [WorstStatus] directly without SELECTCOLUMNS, an error is thrown that it is not a table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions on how to try to correct this or another approach to test would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks ahead of time.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 01:09:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-Based-On-Measure-Value/m-p/831924#M6036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-30T01:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Table Based On Measure Value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-Based-On-Measure-Value/m-p/833134#M6069</link>
      <description>&lt;P&gt;I looped back to a result which worked with single values ( FILTER( __DS0Core,'Meta_EngStatusSummary'[WorstStatus2] =@ProjStatus) ) and realized I was over-thinking this... This is the EVALUATE statement which ended up working for me:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FILTER( __DS0Core,'Meta_EngStatusSummary'[WorstStatus2] IN GetKeyStatusColumn)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 23:27:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-Based-On-Measure-Value/m-p/833134#M6069</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-30T23:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Table Based On Measure Value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-Based-On-Measure-Value/m-p/1677846#M34370</link>
      <description>&lt;P&gt;Thanks a lot, I had similar problem and your approach gave me the solution:&lt;/P&gt;&lt;P&gt;Measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Current Week = WEEKNUM(TODAY() , 21 )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Total Planned Week WO =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALCULATE ( COUNT ( 'WO'[WO Number] ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WO[WO Status] IN { "MH", "MJ", "MK" },&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILTER( WO,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WO[Planned Week] IN { [Current Week] } ) )&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 16:39:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-Based-On-Measure-Value/m-p/1677846#M34370</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-19T16:39:38Z</dc:date>
    </item>
  </channel>
</rss>

