<?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: Calculate with filter expressions in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-filter-expressions/m-p/3051529#M105124</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , I think you should try new Index function , that can help &lt;/P&gt;
&lt;P&gt;Power BI Index function: Top/Bottom Performer by name and value- &lt;A href="https://youtu.be/HPhzzCwe10U" target="_blank"&gt;https://youtu.be/HPhzzCwe10U&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2023 02:25:27 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2023-01-31T02:25:27Z</dc:date>
    <item>
      <title>Calculate with filter expressions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-filter-expressions/m-p/3049981#M105016</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have following measure which doesn't work when i am using variable &lt;STRONG&gt;varRank2&amp;nbsp;&lt;/STRONG&gt;as a condition with &lt;STRONG&gt;CurrentVal.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Ratio Kms For Rank2 To Actual = 
VAR varRank2 = 'FPOC Main'[Rank 2 Kms By Month]

VAR TotalActual =    
    CALCULATE(
        MAX('FPOC Main'[ActualSumFromViewSummary]),
        'FPOC Main'[FPOC_Date] = SELECTEDVALUE(DimDate[DateInDateFormat])
    )

VAR CurrentVal = 
    CALCULATE(
        SUM('FPOC Main'[kms]),
        FILTER(
            'FPOC Main',
            'FPOC Main'[Measurement_End_Code] = varRank2
        )
    )
VAR Ratio = 
DIVIDE(
    CurrentVal,
    TotalActual,
    0
)
RETURN 
CurrentVal&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;varRank2&amp;nbsp;&lt;/STRONG&gt;returns text value which should filter 'FPOC Main' table to second Measure_End_Code name based on calculated percentage.&lt;BR /&gt;Measure &lt;STRONG&gt;Rank 2 Kms By Month&amp;nbsp;&lt;/STRONG&gt;is calculated as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rank 2 Kms By Month = 
CALCULATE(
    MAX('FPOC Main'[Measurement_End_Code]),
    FILTER(
        VALUES('FPOC Main'[Measurement_End_Code]),
        RANKX(
            ALL('FPOC Main'[Measurement_End_Code]), 
            CALCULATE('FPOC Main'[% Kms By Month]))=2
    )
)&lt;/LI-CODE&gt;&lt;P&gt;and when i put that value in card visual it shows correct value. Further more, there are also Rank1 measures build in the same way and those seems to work, so filter expression in CurrentVal works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;One more thing, when i put literal value instead of a variable value it works.&lt;BR /&gt;Can't figure it out, no idea what is going on.&lt;/P&gt;&lt;P&gt;Any help?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 09:20:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-filter-expressions/m-p/3049981#M105016</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-30T09:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate with filter expressions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-filter-expressions/m-p/3051529#M105124</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , I think you should try new Index function , that can help &lt;/P&gt;
&lt;P&gt;Power BI Index function: Top/Bottom Performer by name and value- &lt;A href="https://youtu.be/HPhzzCwe10U" target="_blank"&gt;https://youtu.be/HPhzzCwe10U&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 02:25:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-with-filter-expressions/m-p/3051529#M105124</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2023-01-31T02:25:27Z</dc:date>
    </item>
  </channel>
</rss>

