Forum Discussion
PradneshSP
3 years agoFrequent Visitor
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
- johnt75Super User
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.
- PradneshSPFrequent Visitor
It still provides wrong results
- johnt75Super User
My mistake. I have edited my original post to include the required CALCULATE around the SUM.