LaurentCouartou's avatar
LaurentCouartou
Icon for Solution Supplier rankSolution Supplier
7 years ago
Status:
Accepted

Inconsistent results with SUMMARIZE

I extracted this issue from an 2016 post, as the "recent" update to the SUMMARIZE behavior did not fix the issue described there (
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Is-there-sth-wrong-with-summarize-function/m-p/74527#M93).


Let us create two queries Sales and Sales2 with the queries below. Note that Sales2 references Sales and only differs in the column ordering.

 

// Sales
let
Source = Table.FromRows(Json.Document(Binary.Decompress
(Binary.FromText("i45WcsrMTlXSUQpKTQGSTkqxOtFKwRmZRSU4xNyLUlPz4KJQzTBBR8JKnXJKU+EqMcRiAQ==",
BinaryEncoding.Base64),Compression.Deflate)),
let _t = ((type text) meta [Serialized.Text = true])
in type table [Product = _t, Color = _t, Model = _t]),
#"Type modifié" = Table.TransformColumnTypes(Source,{{"Product", type text},
{"Color", type text}, {"Model", type text}})
in
#"Type modifié"
// Sales2
let
Source = Sales,
#"Colonnes triées" = Table.ReorderColumns(
Source,{"Model", "Product", "Color"})
in #"Colonnes triées"



Now, let us create two calculated tables in our model.

 

TestSales = SUMMARIZE ( Sales;
    Sales[Color];
    "AllColorSales"; 
    CALCULATE (
        COUNTROWS ( Sales ); 
        ALL ( Sales[Color] )
     )
)

 

And the equivalent query based on Sales2:

TestSales2 = SUMMARIZE ( Sales2;
     Sales2[Color];
       "AllColorSales2"; 
       CALCULATE ( 
            COUNTROWS ( Sales2 )
                ; ALL ( Sales2[Color] ) 
            )     
    )


Unexpectedly, both queries do not return the same results:


 

 

 

 

4 Comments

  • Anonymous's avatar
    Anonymous
    Not applicable

    LaurentCouartou,

    I have reported this issue internally: CRI 101349806, will post back once I get any updates.

    Regards,
    Lydia

  • Anonymous's avatar
    Anonymous
    Not applicable

    LaurentCouartou,

    I got response from PG:

    "This is a known product defect that's extremely risky to fix. We have communicated this to Alberto who initially reported this issue. We also communicated to Alberto that this usage of Summarize is highly discouraged and should be replaced by alternatives using AddColumns or SummarizeColumns. Considering the high risk of a fix and low benefit of a deprecated usage pattern, we decided not to fix the issue unless there is a strong business justification for it."

    Reagrds,
    Lydia