<?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: DAX to measure Same Store Sale in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-measure-Same-Store-Sale/m-p/4018906#M158520</link>
    <description>&lt;P&gt;It worked perfectly. Thank you so much!!&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2024 16:04:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-07-01T16:04:53Z</dc:date>
    <item>
      <title>DAX to measure Same Store Sale</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-measure-Same-Store-Sale/m-p/4016246#M158325</link>
      <description>&lt;P&gt;Hello everyone!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am having trouble writing a DAX formula in Power BI to calculate Same Store Sales (SSS). My calculation of SSS is (CURRENT_VALUE_ / PREVIOUS_VALUE_) - 1.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The problem is that, when looking at the CLIENT_ID hierarchy in a matrix visual in Power BI, I want the SSS measure to consider only the CURRENT_VALUE_ of the brands that also had sales in PREVIOUS_VALUE_.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;For example, in the figure below, I want CLIENT_ID 123456 to show me an SSS of 27% in total, instead of 100%. That is, I want it to consider (140 / 110) - 1, instead of (220 / 110) - 1, as it should only sum the CURRENT_VALUE_ of the brands that also have PREVIOUS_VALUE_ (that is, only the GREEN and PINK brands).&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My current DAX formula is as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;VAR tempTable = SUMMARIZE(clients, clients[CLIENT_ID], "PER_ATUAL", [CURRENT_VALUE_] ,"PER_ANTER", [PREVIOUS_VALUE_])&lt;BR /&gt;VAR currentValue = SUMX(FILTER(tempTable, NOT ISBLANK([PER_ATUAL]) &amp;amp;&amp;amp; NOT ISBLANK([PER_ANTER])), [PER_ATUAL])&lt;BR /&gt;VAR previousValue = SUMX(FILTER(tempTable, NOT ISBLANK([PER_ATUAL]) &amp;amp;&amp;amp; NOT ISBLANK([PER_ANTER])), [PER_ANTER])&lt;BR /&gt;&lt;BR /&gt;RETURN&lt;BR /&gt;IF(DIVIDE(currentValue, previousValue, BLANK()) -1 = -1 ,&lt;BR /&gt;BLANK(),&lt;BR /&gt;DIVIDE(currentValue, previousValue, BLANK()) -1&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;Any help or tips?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 20:12:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-measure-Same-Store-Sale/m-p/4016246#M158325</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-28T20:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to measure Same Store Sale</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-measure-Same-Store-Sale/m-p/4016503#M158339</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how you semantic model looks like, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&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;
&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;
&lt;LI-CODE lang="markup"&gt;Current sales: = 
SUM( sales[sales] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Previous sales: = 
CALCULATE (
    [Current sales:],
    OFFSET ( -1, ALL ( 'year'[year] ), ORDERBY ( 'year'[year], ASC ) )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Expected result measure: = 
VAR _t =
    FILTER (
        ADDCOLUMNS (
            SUMMARIZE ( sales, client[client_id], store[store_id], 'year'[year] ),
            "@current", [Current sales:],
            "@prev", [Previous sales:]
        ),
        NOT ISBLANK ( [@prev] )
    )
VAR _result =
    DIVIDE ( SUMX ( _t, [@current] ), SUMX ( _t, [@prev] ) ) - 1
RETURN
    IF ( NOT ISBLANK ( [Previous sales:] ), _result )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jun 2024 08:21:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-measure-Same-Store-Sale/m-p/4016503#M158339</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-06-29T08:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to measure Same Store Sale</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-measure-Same-Store-Sale/m-p/4018906#M158520</link>
      <description>&lt;P&gt;It worked perfectly. Thank you so much!!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 16:04:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-measure-Same-Store-Sale/m-p/4018906#M158520</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-01T16:04:53Z</dc:date>
    </item>
  </channel>
</rss>

