<?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 Create Measure With Filter Conditions in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3989370#M154658</link>
    <description>&lt;P&gt;I'm trying to create a measure that uses some conditions for the final result that will included in a table visual. I have 3 previously created measures, one for Sales, one for Costs and one for Rebates. I also have a column in the data for various categories - A, B, C and D. I need to create a measure that calculates net margin for each of the categories, but when the category is A, I need to include rebates, otherwise just use Sales and Costs.&amp;nbsp; So, something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NetMargin = IF([Category] = "A", [TotalSales] -&amp;nbsp; [TotalCosts] + [TotalRebates], [TotalSales] - [TotalCosts])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where I'm running into trouble is the IF([Category] = "A" piece. I get a red underline under the [Category] part with an error message saying "Cannot find name [Category]".&amp;nbsp; I'm positive I have the syntax wrong but not sure how to correct it.&amp;nbsp; Any ideas what I'm missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2024 18:03:07 GMT</pubDate>
    <dc:creator>rbowen</dc:creator>
    <dc:date>2024-06-12T18:03:07Z</dc:date>
    <item>
      <title>Create Measure With Filter Conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3989370#M154658</link>
      <description>&lt;P&gt;I'm trying to create a measure that uses some conditions for the final result that will included in a table visual. I have 3 previously created measures, one for Sales, one for Costs and one for Rebates. I also have a column in the data for various categories - A, B, C and D. I need to create a measure that calculates net margin for each of the categories, but when the category is A, I need to include rebates, otherwise just use Sales and Costs.&amp;nbsp; So, something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NetMargin = IF([Category] = "A", [TotalSales] -&amp;nbsp; [TotalCosts] + [TotalRebates], [TotalSales] - [TotalCosts])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where I'm running into trouble is the IF([Category] = "A" piece. I get a red underline under the [Category] part with an error message saying "Cannot find name [Category]".&amp;nbsp; I'm positive I have the syntax wrong but not sure how to correct it.&amp;nbsp; Any ideas what I'm missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 18:03:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3989370#M154658</guid>
      <dc:creator>rbowen</dc:creator>
      <dc:date>2024-06-12T18:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create Measure With Filter Conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3989486#M154672</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF(&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECTEDVALUE(&lt;/SPAN&gt;&lt;SPAN&gt;[Category]) = "A", [TotalSales] -&amp;nbsp; [TotalCosts] + [TotalRebates], [TotalSales] - [TotalCosts])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Jun 2024 19:30:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3989486#M154672</guid>
      <dc:creator>Kaviraj11</dc:creator>
      <dc:date>2024-06-12T19:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create Measure With Filter Conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3989511#M154676</link>
      <description>&lt;P&gt;Thanks Kaviraj11, but this doesn't work either. I still get the same red underline under [Category] with the same error message. I've also tried using the aggregator SUM but same problem. Seems to be related to using a column name with the IF statement in combination with the measures. The syntax is almost certainly incorrect but I'm not sure what the correct syntax should be.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 19:56:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3989511#M154676</guid>
      <dc:creator>rbowen</dc:creator>
      <dc:date>2024-06-12T19:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create Measure With Filter Conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3990040#M154732</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="370895" data-lia-user-login="rbowen" class="lia-mention lia-mention-user"&gt;rbowen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="663143" data-lia-user-login="Kaviraj11" class="lia-mention lia-mention-user"&gt;Kaviraj11&lt;/a&gt;&amp;nbsp;Thank you very much for your prompt reply. Allow me to share some content here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
IF(
    SELECTEDVALUE('Table'[Category]) = "A", // YourTableName[Category] = "A", 
    [TotalSales] -  [TotalCosts] + [TotalRebates], 
    [TotalSales] - [TotalCosts]
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 02:55:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3990040#M154732</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-13T02:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create Measure With Filter Conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3993866#M155036</link>
      <description>&lt;P&gt;Thank you for the reply Nono. I gave up on this approach and went a different direction by restructuring some of the data and altering some of the relationships.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 18:24:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/3993866#M155036</guid>
      <dc:creator>rbowen</dc:creator>
      <dc:date>2024-06-14T18:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create Measure With Filter Conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/4008533#M157378</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="370895" data-lia-user-login="rbowen" class="lia-mention lia-mention-user"&gt;rbowen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you tell me if your problem is solved? If yes, please accept it as solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 07:29:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Measure-With-Filter-Conditions/m-p/4008533#M157378</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-25T07:29:17Z</dc:date>
    </item>
  </channel>
</rss>

