<?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: Wrong measurement with IF in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840307#M150135</link>
    <description>&lt;P&gt;I would like to get an output like this, where however the total number of completed orders can only be equal to or less than the orders.&lt;/P&gt;&lt;P&gt;I take data from two tables orders and completed orders, I don't want to identify duplicate data, I just want to count orders by day and location for the two tables and get a maximum of 100%&lt;/P&gt;&lt;P&gt;As I wrote at the beginning I thought of simply solving with an IF, but that's not possible.&lt;/P&gt;&lt;P&gt;I assume I need to create a virtual table with both data; orders and completed orders, and then set an IF condition.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Apr 2024 07:27:58 GMT</pubDate>
    <dc:creator>Newbobotime</dc:creator>
    <dc:date>2024-04-16T07:27:58Z</dc:date>
    <item>
      <title>Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3837646#M150032</link>
      <description>&lt;P&gt;Hi everyone,&lt;BR /&gt;I have a problem, maybe it's simple but I don't understand how to solve it.&lt;/P&gt;&lt;P&gt;I present the data for this measure in a table in which I would like to calculate the percentage of a hypothetical number of completed orders.&lt;BR /&gt;For some strange reason completed orders always seem to be higher than total orders so I thought I'd put an IF; if the result of the completed orders count is greater than the total orders count, do the total orders count, otherwise do the completed orders count.&lt;BR /&gt;If I look at the data presented for each record it seems correct but the total sum does not add up, it does not remove the excess numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;total_order =
VAR new = CALCULATE(COUNTX(order_new, order_new [code]))
VAR complete = CALCULATE(COUNTX(order_complete, order_complete[code]))
VAR result = IF(new &amp;gt; complete, new, complete)
RETURN
result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 09:06:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3837646#M150032</guid>
      <dc:creator>Newbobotime</dc:creator>
      <dc:date>2024-04-15T09:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3837811#M150034</link>
      <description>&lt;P&gt;Please, try this version:&lt;BR /&gt;&lt;BR /&gt;total_order =&lt;BR /&gt;VAR new =&lt;BR /&gt;CALCULATE ( COUNTX ( VALUES ( order_new[code] ), order_new[code] ) )&lt;BR /&gt;VAR complete =&lt;BR /&gt;CALCULATE ( COUNTX ( VALUES ( order_complete[code] ), order_complete[code] ) )&lt;BR /&gt;VAR result =&lt;BR /&gt;IF ( new &amp;gt; complete, new, complete )&lt;BR /&gt;RETURN&lt;BR /&gt;result&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 09:57:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3837811#M150034</guid>
      <dc:creator>Pavel_Gutsol</dc:creator>
      <dc:date>2024-04-15T09:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3838424#M150055</link>
      <description>&lt;P&gt;Thanks Pavel, for the help but it doesn't work,&lt;BR /&gt;I assume this way it can't iterate, it proposes the same number for all records&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 13:22:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3838424#M150055</guid>
      <dc:creator>Newbobotime</dc:creator>
      <dc:date>2024-04-15T13:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3839679#M150117</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="724693" data-lia-user-login="Pavel_Gutsol" class="lia-mention lia-mention-user"&gt;Pavel_Gutsol&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="643281" data-lia-user-login="Newbobotime" class="lia-mention lia-mention-user"&gt;Newbobotime&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you make some sample data for your problem, and what results do you expect? What fields do you use this metric in your table visual, and what are the contexts it depends on?&amp;nbsp;It would be helpful to have some explanation of the sample data you provided that you expect the results to be. When providing sample data, please do not include any privacy data. Here's a sample I created:&lt;/P&gt;
&lt;P&gt;order_new table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;order_complete table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I use the following DAX expression to find the percentage of completion to new:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Percentage =
VAR _all_new =
    CALCULATE ( COUNTAX ( 'order_new', 'order_new'[code] ), ALL ( order_new ) )
VAR _selected_code =
    SELECTEDVALUE ( order_complete[code] )
VAR _complete =
    CALCULATE (
        COUNTAX (
            FILTER ( ALL ( 'order_complete' ), 'order_complete'[code] &amp;lt;= _selected_code ),
            'order_complete'[code]
        )
    )
RETURN
    DIVIDE ( _complete, _all_new )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Also, you mentioned that in your table visual, total doesn't work, I used the DAX formula you provided here and created a total measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total = SUMX('order_complete',[total_order]) &lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C02%7Cv-jianpengli%40microsoft.com%7Cd9552f18a0c94a7564f308dc188bf35e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638412236574903368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=3jxUE%2BTNC8dS4DIhPphEB3NA%2BK94pwURGHu%2BXC4eezw%3D&amp;amp;reserved=0" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Jianpeng Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, 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>Tue, 16 Apr 2024 03:18:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3839679#M150117</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-16T03:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840283#M150133</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 07:19:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840283#M150133</guid>
      <dc:creator>Newbobotime</dc:creator>
      <dc:date>2024-04-16T07:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840307#M150135</link>
      <description>&lt;P&gt;I would like to get an output like this, where however the total number of completed orders can only be equal to or less than the orders.&lt;/P&gt;&lt;P&gt;I take data from two tables orders and completed orders, I don't want to identify duplicate data, I just want to count orders by day and location for the two tables and get a maximum of 100%&lt;/P&gt;&lt;P&gt;As I wrote at the beginning I thought of simply solving with an IF, but that's not possible.&lt;/P&gt;&lt;P&gt;I assume I need to create a virtual table with both data; orders and completed orders, and then set an IF condition.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 07:27:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840307#M150135</guid>
      <dc:creator>Newbobotime</dc:creator>
      <dc:date>2024-04-16T07:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840335#M150138</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 07:36:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840335#M150138</guid>
      <dc:creator>Newbobotime</dc:creator>
      <dc:date>2024-04-16T07:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840338#M150140</link>
      <description>&lt;P&gt;with a simple "IF", I solve the percentage problem for each record but the subtotal is wrong&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 07:37:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840338#M150140</guid>
      <dc:creator>Newbobotime</dc:creator>
      <dc:date>2024-04-16T07:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840450#M150146</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="643281" data-lia-user-login="Newbobotime" class="lia-mention lia-mention-user"&gt;Newbobotime&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your reply. You can try sumx to get the correct total, and your new Total Orders completed_IF measure might look like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total_Orders_Completed_IF =
SUMX ( 'LOCATION_CODE', [Total Orders completed_IF] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C02%7Cv-jianpengli%40microsoft.com%7Cd9552f18a0c94a7564f308dc188bf35e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638412236574903368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=3jxUE%2BTNC8dS4DIhPphEB3NA%2BK94pwURGHu%2BXC4eezw%3D&amp;amp;reserved=0" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Jianpeng Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, 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>Tue, 16 Apr 2024 08:04:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840450#M150146</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-16T08:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840919#M150161</link>
      <description>&lt;P&gt;Maybe I solved it.&lt;BR /&gt;Sure the code could be written better but it seems to work.&lt;BR /&gt;First of all I created a new table with summarize, determining the total orders and for the completed orders data I performed a comparison with the IF.&lt;BR /&gt;Subsequently I created the various measurements using this table&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 10:02:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3840919#M150161</guid>
      <dc:creator>Newbobotime</dc:creator>
      <dc:date>2024-04-16T10:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3842913#M150236</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="643281" data-lia-user-login="Newbobotime" class="lia-mention lia-mention-user"&gt;Newbobotime&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your reply and the solution you shared. I decided it was a great idea to create a summary table. You can mark your response as a solution so that others in the community can quickly find a solution if they encounter a similar problem. Thanks again for sharing!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Jianpeng Li&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 01:25:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3842913#M150236</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-17T01:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong measurement with IF</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3844362#M150267</link>
      <description>&lt;P&gt;Perhaps there is a more correct method but I think I solved it by creating a table with "Summarize" and then setting the various measures; total orders, total_completed_orders, %completed_orders&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 07:34:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Wrong-measurement-with-IF/m-p/3844362#M150267</guid>
      <dc:creator>Newbobotime</dc:creator>
      <dc:date>2024-04-17T07:34:58Z</dc:date>
    </item>
  </channel>
</rss>

