title: Incorrect summarization of values in Power BI
body: <p>I have a table in power BI that looks like this:</p>
  <p><a href="https://i.stack.imgur.com/hPHxb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hPHxb.png" alt="enter image description here" /></a></p>
  <p>day_grow is the percent change in gross_sum between current event_date and previous event_date for the same trans_typer, channel, and country. This is correct.</p>
  <p>When I deselect trans_type, channel, and country to see aggregates for event_date, I see the following table:</p>
  <p><a href="https://i.stack.imgur.com/IvDTe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IvDTe.png" alt="enter image description here" /></a></p>
  <p>Gross_sum sums up to correct values for every event_date but day_grow values are incorrect. They should be the percent change in gross_sum between current event_date and previous event_date.</p>
  <p>The original query is Clickhouse syntax:</p>
  <pre><code>    SELECT
      event_date,
      sum(gross_sum) as gross,
      ifNotFinite((gross - sum(minus1day_rev)) / sum(minus1day_rev) , 0) as day_grow,
      ifNotFinite((gross - sum(minus7day_rev)) / sum(minus7day_rev) , 0) as 7day_grow,
      ifNotFinite((gross - sum(avg_7day_rev)) / sum(avg_7day_rev) , 0) as avg_7_days_grow
  FROM
       (SELECT event_date,
               trans_type,
               channel,
               country,
               gross_sum,
               if(neighbor(country, 1) = country,
                   if (neighbor(channel, 1) = channel,
                          if(neighbor(trans_type,1)=trans_type,
                              if(neighbor(event_date,1)=event_date-1,
                                  neighbor(gross_sum, 1),0), 0),0),0) AS minus1day_rev,
               if(neighbor(event_date,1)!=event_date-2,
                      if(neighbor(country, 2) = country,
                          if (neighbor(channel, 2) = channel,
                           if(neighbor(trans_type,2)=trans_type,
                              if(neighbor(event_date,2)=event_date-2,
                                  neighbor(gross_sum, 2),0), 0),0),0),neighbor(gross_sum,1)) AS minus2day_rev,
               if(neighbor(event_date,1)!=event_date-3,
                      if(neighbor(country, 3) = country,
                          if (neighbor(channel, 3) = channel,
                           if(neighbor(trans_type,3)=trans_type,
                              if(neighbor(event_date,3)=event_date-3,
                                  neighbor(gross_sum, 3),0), 0),0),0),neighbor(gross_sum,1)) AS minus3day_rev,
               if(neighbor(event_date,1)!=event_date-4,
                      if(neighbor(country, 4) = country,
                          if (neighbor(channel, 4) = channel,
                           if(neighbor(trans_type,4)=trans_type,
                              if(neighbor(event_date,4)=event_date-4,
                                  neighbor(gross_sum, 4),0), 0),0),0),neighbor(gross_sum,1)) AS minus4day_rev,
               if(neighbor(event_date,1)!=event_date-5,
                      if(neighbor(country, 5) = country,
                          if (neighbor(channel, 5) = channel,
                           if(neighbor(trans_type,5)=trans_type,
                              if(neighbor(event_date,5)=event_date-5,
                                  neighbor(gross_sum, 5),0), 0),0),0),neighbor(gross_sum,1)) AS minus5day_rev,
               if(neighbor(event_date,1)!=event_date-6,
                      if(neighbor(country, 6) = country,
                          if (neighbor(channel, 6) = channel,
                           if(neighbor(trans_type,6)=trans_type,
                              if(neighbor(event_date,6)=event_date-6,
                                  neighbor(gross_sum, 6),0), 0),0),0),neighbor(gross_sum,1)) AS minus6day_rev,
               if(neighbor(event_date,1)!=event_date-7,
                      if(neighbor(country, 7) = country,
                          if (neighbor(channel, 7) = channel,
                           if(neighbor(trans_type,7)=trans_type,
                              if(neighbor(event_date,7)=event_date-7,
                                  neighbor(gross_sum, 7),0), 0),0),0),neighbor(gross_sum,1)) AS minus7day_rev,
               if(neighbor(event_date,1)!=event_date-8,
                      if(neighbor(country, 8) = country,
                          if (neighbor(channel, 8) = channel,
                           if(neighbor(trans_type,8)=trans_type,
                              if(neighbor(event_date,8)=event_date-8,
                                  neighbor(gross_sum, 8),0), 0),0),0),neighbor(gross_sum,1)) AS minus8day_rev,
               (minus1day_rev + minus2day_rev + minus3day_rev + minus4day_rev + minus5day_rev + minus6day_rev +
                minus7day_rev) / 7                                            as avg_7day_rev
        from (select event_date,
                     trans_type,
                     channel,
                     country,
                     sum(amount / 100) AS gross_sum
              FROM example
              WHERE event_date &gt;= addWeeks(toMonday(today()), - 72)
                AND event_date &lt; today()
                AND attraction_networkname = 'a'
                AND trans_type IN ('trial', 'initial', 'conversion', 'rebill')
                AND lower(member_email) GLOBAL NOT IN
                    (SELECT lower(email)
                     FROM globica.view_test_emails_t2)
              group by event_date,
                       trans_type,
                       channel,
                       country
              ORDER by country desc,
                       channel desc,
                       trans_type desc,
                       event_date desc)
           )
  group by event_date
  order by event_date desc
  </code></pre>
  <p>Please help!</p>