<?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: Obtener costo promedio in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Obtener-costo-promedio/m-p/4121091#M163615</link>
    <description>&lt;P&gt;Hi&amp;nbsp;@&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/725329" target="_self"&gt;&lt;SPAN class=""&gt;v-linyulu-msft&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;P&gt;My index for me is the column "UltimoCambio" and I have this excel that can help you to understand better&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;this is how it should look and you can look that when&amp;nbsp;it switch mov for "entrada importacion" the calculated cost changes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;</description>
    <pubDate>Tue, 27 Aug 2024 15:54:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-08-27T15:54:38Z</dc:date>
    <item>
      <title>Obtener costo promedio</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Obtener-costo-promedio/m-p/4119502#M163552</link>
      <description>&lt;P&gt;Hola a todos&lt;/P&gt;&lt;P&gt;Tengo el siguiente problema.&lt;/P&gt;&lt;P&gt;Quiero obtener el costo promedio de los siguientes movimientos, logre obtener el valor de la fecha de una fila anterior esto ya que el costo promedio debe de ser el mismo hasta que cambien el movimiento a una entrada de importacion y re hacer el calculo de "costo X Tipo de Cambio" X "Saldo final", de la siguiente manera recuró la fecha de la fila anterior&lt;/P&gt;&lt;DIV&gt;&lt;DIV&g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N&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;SPAN&gt;fecha_anterior&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;DIV&gt;y asi es como deberia de quedar&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Aug 2024 23:18:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Obtener-costo-promedio/m-p/4119502#M163552</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-26T23:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Obtener costo promedio</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Obtener-costo-promedio/m-p/4120019#M163572</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Regarding the issue you raised, my solution is as follows:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;1.First I have created the following table and the column names and data are the data you have given:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&lt;/SPAN&gt;&lt;SPAN&gt;Insert the index column&lt;/SPAN&gt;&lt;SPAN&gt;：&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;3. Below are the measure I've created for your needs:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MEASURE = 
IF (
    MAX ( 'Movimientos'[Mov] ) &amp;lt;&amp;gt; "2.1 Factura",
    CALCULATE (
        SUM ( 'Movimientos'[Costo x Tipo de Cambio] ),
        FILTER (
            ALLSELECTED ( 'Movimientos' ),
            'Movimientos'[Index]
                = MAX ( 'Movimientos'[Index] ) + 1
        )
    ),
    SUM ( 'Movimientos'[Costo x Tipo de Cambio] )
)&lt;/LI-CODE&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;4.Here's my final result, which I hope meets your requirements.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Please find the attached pbix relevant to the case.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 06:28:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Obtener-costo-promedio/m-p/4120019#M163572</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-27T06:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Obtener costo promedio</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Obtener-costo-promedio/m-p/4121091#M163615</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/725329" target="_self"&gt;&lt;SPAN class=""&gt;v-linyulu-msft&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;P&gt;My index for me is the column "UltimoCambio" and I have this excel that can help you to understand better&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;this is how it should look and you can look that when&amp;nbsp;it switch mov for "entrada importacion" the calculated cost changes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 15:54:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Obtener-costo-promedio/m-p/4121091#M163615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-27T15:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Obtener costo promedio</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Obtener-costo-promedio/m-p/4121779#M163661</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Thank you for your correction, but I think I did not express clearly the reason why I chose to insert index.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;If I use the "UltimoCambio" column you provided as the index column, it is difficult to uniquely identify the number of rows because it has the same content, so I choose to insert an index column as the identifier. And my initial judgment statement also takes into account the "UltimoCambio" column.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Thank you for your understanding.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Of course, if you have any new ideas, you are welcome to contact us.&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 03:04:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Obtener-costo-promedio/m-p/4121779#M163661</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-28T03:04:13Z</dc:date>
    </item>
  </channel>
</rss>

