Forum Discussion

ryan-gao's avatar
ryan-gao
Helper III
9 years ago
Solved

Is there sth wrong with summarize function?

I Reproduce the scenario in http://www.sqlbi.com/articles/all-the-secrets-of-summarize/, but  the answer is different. anyone can explain it?   change the first product from bike to shirt, t...
  • LaurentCouartou's avatar
    LaurentCouartou
    9 years ago

    Well, the Power Pivot engine in Excel 2016 is not the same as the one used by Excel 2013 (when Marco Russo wrote his article).

     

    I have made a few tests, and here are my conclusions: this is a bug.

     

    The long version is the behaviour no longer works as Marco Russo explained in his article. There is still an implicit filter but only on the first column in the table (at the time of creation).

     

    If you create a new table with columns listed in this order: Quantity, Product, Color, Amount, like this:

     

    QuantityProductColorAmount
    1ShirtRed100
    2ShirtRed200
    2ShirtGreen200
    3BikeGreen300
    3ShirtGreen300
    3BikeBlue300
    4ShirtBlue400

     

    Your query should now return the following:

    Color allcolorsales

    Red     500

    Green 1300

    Blue    1300

     

    Note that, according to my observations, what is relevant is the columns order when the table was created. Re-ordering the columns afterwards does not seem to change the results of the query. This is, in my opinion, a bug.