Forum Discussion

PradneshSP's avatar
PradneshSP
Frequent Visitor
3 years ago
Solved

Summarize function providing wrong results.

I'm trying to summarize a table to display values by month 

 

SUMMARIZE(Sales_View,Sales_View[Div],Sales_View[Code],Sales_View[Brands],Sales_View[Billing Month_Year],Sales_View[Type],"Value",SUM(Sales_View[VALUE]))
 
The SUM is calculated wrong. It's displaying more than expected value.
  • Don't use SUMMARIZE to add calculated columns, use ADDCOLUMNS instead

     

     

    ADDCOLUMNS (
        SUMMARIZE (
            Sales_View,
            Sales_View[Div],
            Sales_View[Code],
            Sales_View[Brands],
            Sales_View[Billing Month_Year],
            Sales_View[Type]
        ),
        "Value", CALCULATE( SUM ( Sales_View[VALUE] ) )
    )
    

     

     

    If you're interested, there's a SQL BI article about it.

3 Replies

  • Don't use SUMMARIZE to add calculated columns, use ADDCOLUMNS instead

     

     

    ADDCOLUMNS (
        SUMMARIZE (
            Sales_View,
            Sales_View[Div],
            Sales_View[Code],
            Sales_View[Brands],
            Sales_View[Billing Month_Year],
            Sales_View[Type]
        ),
        "Value", CALCULATE( SUM ( Sales_View[VALUE] ) )
    )
    

     

     

    If you're interested, there's a SQL BI article about it.

    • johnt75's avatar
      johnt75
      Super User

      My mistake. I have edited my original post to include the required CALCULATE around the SUM.