<?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: Error message with the calculate function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2228172#M53128</link>
    <description>&lt;P&gt;Ok so I have this data model&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Client table&lt;/STRONG&gt;&lt;/U&gt; with : IdCustomer / SalesRep / Area / CustomerProfil&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;ProductTable&lt;/STRONG&gt;&lt;/U&gt; : IdProduct / ProductName / &lt;STRONG&gt;24StrategicProduct&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;SalesTable&lt;/STRONG&gt;&lt;/U&gt; : IdCustomer /IdProduct&amp;nbsp; / Sales&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 - I want to calculate for each customer the number of strategic product he had pruchased.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; i did this :&amp;nbsp; &lt;EM&gt;calculate ( distinctcount(SalesTable [IdProduct]),&amp;nbsp;ProductTable[&lt;STRONG&gt;24StrategicProduct&lt;/STRONG&gt;]="Yes")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;And it Works, when I set up a table with all my customers i do have the count of my stratgic products each clients had purchased.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2- Now I want to set up a table with&amp;nbsp;my CustomerProfil ( wich contains only 3 values A B C ) and add a measure that return the number of customers who have purchased at least one time all my 24 strategic products.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; and i'm stuck in this formula &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tnx&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Dec 2021 15:53:05 GMT</pubDate>
    <dc:creator>Touaibia</dc:creator>
    <dc:date>2021-12-08T15:53:05Z</dc:date>
    <item>
      <title>Error message with the calculate function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227223#M53062</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a date model with :&lt;/P&gt;&lt;P&gt;Sales table&amp;nbsp;&lt;/P&gt;&lt;P&gt;Product table&amp;nbsp;&lt;/P&gt;&lt;P&gt;Customer table&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my company we have 24 products that we are pushing and I want to know how many customer purchased this 24 products.&lt;/P&gt;&lt;P&gt;I have a column in my product table&amp;nbsp;which contains two values " Yes" , "No". Yes, refers to all these strategic products.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this approach:&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;At first I calculate the this measure&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;NB 24 Refs =&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;/P&gt;&lt;P&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;DISTINCTCOUNT(Sales_Table[IdProduct]),&amp;nbsp;&lt;/P&gt;&lt;P&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; Product_table = "Yes")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this formula when I set up a table with all my customers I can see how many products of my 24 strategic products each costumer had purchased at least one time. and all is OK&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now here my issue, in another page I want to set up a broader vision where each sales rep could see how many of his customers have purchased the 24 products.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Soo I tried this formula:&amp;nbsp; &amp;nbsp;at the first shot I calculated the 24_status : if( [nb 24 refs] = 24 , "On target","Below target")&amp;nbsp; and it works perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the final formula :&amp;nbsp;&lt;/P&gt;&lt;P&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CALCULATE(&lt;/P&gt;&lt;P&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; &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;DISTINCTCOUNT(Sales_Table[IdCustomer]),&lt;/P&gt;&lt;P&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; &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;[24_status]="On target")&lt;/P&gt;&lt;P&gt;And I get this error message:&amp;nbsp;&lt;/P&gt;&lt;P&gt;A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m stuck on this issue and I can't find a solution, any advice or tip to solve this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tnx&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 08 Dec 2021 08:30:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227223#M53062</guid>
      <dc:creator>Touaibia</dc:creator>
      <dc:date>2021-12-08T08:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Error message with the calculate function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227263#M53069</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I had a similar issue yesterday on one of my projects. The workaround I came up with was to create an intermediate measure for calculating the status based on my condition and then using a SUMX function to calculate count.&lt;BR /&gt;&lt;BR /&gt;So in essence:&lt;BR /&gt;&lt;STRONG&gt;[Helper measure] = IF(Sales_Table[24_status]="On target",1,0)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;[Final measure] = SUMX(Sales_Table,[Helper measure])&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hopefully this helps and if it does consider accepting this post as a solution!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 08:54:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227263#M53069</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-08T08:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error message with the calculate function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227307#M53073</link>
      <description>&lt;P&gt;Unfortunately it doesn't work i have 0 on each row when i put this measure in a table with my sales reps&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 09:19:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227307#M53073</guid>
      <dc:creator>Touaibia</dc:creator>
      <dc:date>2021-12-08T09:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Error message with the calculate function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227348#M53077</link>
      <description>&lt;P&gt;Okay, a new idea mirroring your original idea:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Count of onTarget = COUNTROWS(filter(Target,Target[Column1]="OnTarget"))&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;Test data:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End result:&lt;/P&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;</description>
      <pubDate>Wed, 08 Dec 2021 09:35:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227348#M53077</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-08T09:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error message with the calculate function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227436#M53080</link>
      <description>&lt;P&gt;My "on target / below target" is a measure not a calculated column soo i can't try this solution &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 10:06:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227436#M53080</guid>
      <dc:creator>Touaibia</dc:creator>
      <dc:date>2021-12-08T10:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Error message with the calculate function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227472#M53082</link>
      <description>&lt;P&gt;In that case your problem should be identical to the one I had yesterday&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;. Maybe the problem is then with SUMX table. You mentioned that you used a table with "sales rep" maybe the measure works if you change the dax like so:&lt;BR /&gt;SUMX('&lt;STRONG&gt;Sales rep&lt;/STRONG&gt;',[Helper measure])&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 10:16:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227472#M53082</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-08T10:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error message with the calculate function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227526#M53085</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317974" data-lia-user-login="Touaibia" class="lia-mention lia-mention-user"&gt;Touaibia&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It'd be better if you shared the sample of your data, right now it's not that clear.&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;Measure = 
Var _A = filter(Addcolumns(Values(Sales_Table[IdProduct]),"No.24P",calculate(Countrows(Product_table),filter(Product_table,Product_table[Product_table]="Yes"))),[No.24P]=24)
return
COUNTX(_A,[No.24P])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;accepting&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;it as the solution&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 10:30:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2227526#M53085</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-12-08T10:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error message with the calculate function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2228172#M53128</link>
      <description>&lt;P&gt;Ok so I have this data model&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Client table&lt;/STRONG&gt;&lt;/U&gt; with : IdCustomer / SalesRep / Area / CustomerProfil&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;ProductTable&lt;/STRONG&gt;&lt;/U&gt; : IdProduct / ProductName / &lt;STRONG&gt;24StrategicProduct&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;SalesTable&lt;/STRONG&gt;&lt;/U&gt; : IdCustomer /IdProduct&amp;nbsp; / Sales&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 - I want to calculate for each customer the number of strategic product he had pruchased.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; i did this :&amp;nbsp; &lt;EM&gt;calculate ( distinctcount(SalesTable [IdProduct]),&amp;nbsp;ProductTable[&lt;STRONG&gt;24StrategicProduct&lt;/STRONG&gt;]="Yes")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;And it Works, when I set up a table with all my customers i do have the count of my stratgic products each clients had purchased.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2- Now I want to set up a table with&amp;nbsp;my CustomerProfil ( wich contains only 3 values A B C ) and add a measure that return the number of customers who have purchased at least one time all my 24 strategic products.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; and i'm stuck in this formula &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tnx&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 15:53:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-message-with-the-calculate-function/m-p/2228172#M53128</guid>
      <dc:creator>Touaibia</dc:creator>
      <dc:date>2021-12-08T15:53:05Z</dc:date>
    </item>
  </channel>
</rss>

