<?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: Subtract two rows with different months in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212045#M19527</link>
    <description>&lt;P&gt;ola,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Não funciona porque dá erro de sintaxe. Não posso trazer a coluna Cockpit[Indicador] para dentro do Filter porque no All invoco&amp;nbsp; a tabela_data.&lt;/P&gt;&lt;P&gt;Já tentei por o filtro da Cockpit[Indicador] de fora e fazer dois FILTER, mas tambem não funciona, está-me a devolver um valor que nem sei onde está a ir buscar agora.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jul 2020 13:50:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-07-09T13:50:05Z</dc:date>
    <item>
      <title>Subtract two rows with different months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1211544#M19507</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create a measure to subtract two rows from the same column based on different dates. The first value needs to be the selected on the slicer and the second one is always December.&lt;/P&gt;&lt;P&gt;I've tried this way but it's not working. The measure returns the first value based on the slicer and the second returns the value of December, but when together the subtraction doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Medida =&lt;/P&gt;&lt;P&gt;VAR mes = SELECTEDVALUE(tabela_data[Mês],0)&lt;/P&gt;&lt;P&gt;Return&lt;/P&gt;&lt;P&gt;CALCULATE(sum(Cockpit[Valor]), Cockpit[Indicador]="FCF ACT YTD",tabela_data[Mês]=mes) CALCULATE(sum(Cockpit[Valor]),Cockpit[Indicador]="FCF OAG YTD",tabela_data[Mês]=12)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also tried replacing the variable "mes" for "4" at the first calculate just to see if it works and it does. So I think the issue is related to the use of a variable with a subtraction&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help, please.&lt;/P&gt;&lt;P&gt;Best regard.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 10:03:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1211544#M19507</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-09T10:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract two rows with different months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1211964#M19520</link>
      <description>&lt;P&gt;Oi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tenta a formula de dezembro assim:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CALCULATE(sum(Cockpit[Valor]), FILTER(ALL(tabela_data), Cockpit[Indicador]="FCF OAG YTD",tabela_data[Mês]=12))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Você precisa ignorar o filtro de data aplicado, caso contrário você não tem nenhum retorno.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 13:23:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1211964#M19520</guid>
      <dc:creator>camargos88</dc:creator>
      <dc:date>2020-07-09T13:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract two rows with different months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1211979#M19522</link>
      <description>is the unwanted result because you are missing the subtraction sign between 2 CALCULATEs</description>
      <pubDate>Thu, 09 Jul 2020 13:13:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1211979#M19522</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2020-07-09T13:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract two rows with different months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212037#M19526</link>
      <description>&lt;P&gt;Not that, I forgot it here, but I have it on the measure.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 13:48:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212037#M19526</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-09T13:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract two rows with different months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212045#M19527</link>
      <description>&lt;P&gt;ola,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Não funciona porque dá erro de sintaxe. Não posso trazer a coluna Cockpit[Indicador] para dentro do Filter porque no All invoco&amp;nbsp; a tabela_data.&lt;/P&gt;&lt;P&gt;Já tentei por o filtro da Cockpit[Indicador] de fora e fazer dois FILTER, mas tambem não funciona, está-me a devolver um valor que nem sei onde está a ir buscar agora.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 13:50:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212045#M19527</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-09T13:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract two rows with different months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212091#M19529</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tenta essa:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Medida = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(SUM('Table'[VALUE]), 'Table'[Indicador] = "A") -&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(SUM('Table'[VALUE]), FILTER(ALL('Table'), 'Table'[Indicador] = "A" &amp;amp;&amp;amp; RELATED('Date'[Mes]) = 12))&lt;/SPAN&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>Thu, 09 Jul 2020 14:09:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212091#M19529</guid>
      <dc:creator>camargos88</dc:creator>
      <dc:date>2020-07-09T14:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract two rows with different months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212105#M19530</link>
      <description>&lt;P&gt;With some adjustments this solution works fine.&lt;/P&gt;&lt;P&gt;I just needed to implement a Filter(ALL()) to all the criteria that I want.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Final result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FCF OAG GAP = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Var Ano = SELECTEDVALUE(tabela_data[Ano],0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Var Mes = SELECTEDVALUE(tabela_data[Mês],0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Calculate(sum(Cockpit[Valor]),FILTER(all(Cockpit),Cockpit[Indicador]="FCF ACT YTD"),filter(all(Cockpit),Cockpit[Região]="Group"),filter(all(tabela_data),tabela_data[Mês]=Mes),FILTER(all(tabela_data),tabela_data[Ano]=Ano))-CALCULATE(sum(Cockpit[Valor]),FILTER(all(Cockpit),Cockpit[Indicador]="FCF OAG YTD"),FILTER(ALL(tabela_data),tabela_data[Mês]=12),FILTER(all(tabela_data),tabela_data[Ano]=Ano),filter(all(Cockpit),Cockpit[Região]="Group"))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks a lot!&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Jul 2020 14:15:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212105#M19530</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-09T14:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract two rows with different months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212112#M19531</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Não sei como você está fazendo o visual, porém talvez não seja necessário aplicar o filtro no valor atual da linha, apenas no anterior, o proprio SUM(VALOR) já vai fazer isso por você. Isso evita sobrecarga, e só vai sentir se seu modelo tem uma grande quantidade de dados.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 14:21:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-two-rows-with-different-months/m-p/1212112#M19531</guid>
      <dc:creator>camargos88</dc:creator>
      <dc:date>2020-07-09T14:21:16Z</dc:date>
    </item>
  </channel>
</rss>

