<?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: VALUES AND ALL FUNCTION AS ARGUMENT FOR AVERAGEX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/VALUES-AND-ALL-FUNCTION-AS-ARGUMENT-FOR-AVERAGEX/m-p/3176163#M114656</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="542043" data-lia-user-login="DASILAR1" class="lia-mention lia-mention-user"&gt;DASILAR1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;1-Create the measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ValueMeasure = SUM(Consulta[VALUE])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2-Create the desired measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;AverageMeasureValue =
CALCULATE (
    AVERAGEX ( VALUES ( Consulta[CustomerCode] ), [ValueMeasure] ),
    FILTER (
        Consulta,
        Consulta[VALUE] &amp;lt;&amp;gt; 0
            &amp;amp;&amp;amp; NOT ISBLANK ( Consulta[VALUE] &amp;lt;&amp;gt; 0 )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this answer solves your problem, give it a thumbs up and mark it as an accepted solution so the others would find what they need easier.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Loran&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2023 14:23:46 GMT</pubDate>
    <dc:creator>MohammadLoran25</dc:creator>
    <dc:date>2023-04-06T14:23:46Z</dc:date>
    <item>
      <title>VALUES AND ALL FUNCTION AS ARGUMENT FOR AVERAGEX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/VALUES-AND-ALL-FUNCTION-AS-ARGUMENT-FOR-AVERAGEX/m-p/3176102#M114648</link>
      <description>&lt;P&gt;Good morning.&lt;/P&gt;&lt;P&gt;I have a question to solve a DAX formula. After struggling for a long time, I believe I have identified the problem, but I have not yet been able to find a solution.&lt;/P&gt;&lt;P&gt;I created a Measure [TX_Visita]&lt;/P&gt;&lt;P&gt;I need to create a measure that calculates the &lt;STRONG&gt;average&lt;/STRONG&gt; of [Tx_Visitas] for each [Service Type and Customer Code]. Below is an example.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created the &lt;STRONG&gt;TempoMedioVisitas&lt;/STRONG&gt; measure, which worked very well. It adds the [Tx_Visista] for each customer (2.33+0.77+0) and divides by the 3 customers.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;However, when I analyzed it, I noticed that those customers who had only one visit (TxVisita=0) end up distorting the result. So I tried to create another measure that does the same calculation, but disregards those customers with TxVisita=0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created TempoMedioVisita2. But the value it returns is completely wrong. T&lt;SPAN&gt;he idea was to add 2.33 and 0.77 and divide by 2, the result should be 1,55 not 1,06.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have come to the conclusion that the error is most likely in the first argument of the AVERAGEX() function, where I need to pass a table as an argument.&lt;/P&gt;&lt;P&gt;I need to create a context where I have for each service type all the customers who have already performed it, but in a unique way. That is, if customer 3727 has already performed 5 Criolipolysis, I need the [3727 Criolipo] row to appear only once, but the ALL function returns all times. The VALUES() function, which does exactly what I need, does not accept two columns as arguments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me? Is my reasoning correct, is the error really this, and if so, how can I fix it?&lt;BR /&gt;&lt;BR /&gt;Tks.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 13:47:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/VALUES-AND-ALL-FUNCTION-AS-ARGUMENT-FOR-AVERAGEX/m-p/3176102#M114648</guid>
      <dc:creator>DASILAR1</dc:creator>
      <dc:date>2023-04-06T13:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: VALUES AND ALL FUNCTION AS ARGUMENT FOR AVERAGEX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/VALUES-AND-ALL-FUNCTION-AS-ARGUMENT-FOR-AVERAGEX/m-p/3176163#M114656</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="542043" data-lia-user-login="DASILAR1" class="lia-mention lia-mention-user"&gt;DASILAR1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;1-Create the measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ValueMeasure = SUM(Consulta[VALUE])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2-Create the desired measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;AverageMeasureValue =
CALCULATE (
    AVERAGEX ( VALUES ( Consulta[CustomerCode] ), [ValueMeasure] ),
    FILTER (
        Consulta,
        Consulta[VALUE] &amp;lt;&amp;gt; 0
            &amp;amp;&amp;amp; NOT ISBLANK ( Consulta[VALUE] &amp;lt;&amp;gt; 0 )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this answer solves your problem, give it a thumbs up and mark it as an accepted solution so the others would find what they need easier.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Loran&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 14:23:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/VALUES-AND-ALL-FUNCTION-AS-ARGUMENT-FOR-AVERAGEX/m-p/3176163#M114656</guid>
      <dc:creator>MohammadLoran25</dc:creator>
      <dc:date>2023-04-06T14:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: VALUES AND ALL FUNCTION AS ARGUMENT FOR AVERAGEX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/VALUES-AND-ALL-FUNCTION-AS-ARGUMENT-FOR-AVERAGEX/m-p/3176214#M114661</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;I managed to find the solution.
I'll leave it below in case anyone has a similar question.&lt;/SPAN&gt;&lt;/PRE&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;</description>
      <pubDate>Thu, 06 Apr 2023 14:45:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/VALUES-AND-ALL-FUNCTION-AS-ARGUMENT-FOR-AVERAGEX/m-p/3176214#M114661</guid>
      <dc:creator>DASILAR1</dc:creator>
      <dc:date>2023-04-06T14:45:02Z</dc:date>
    </item>
  </channel>
</rss>

