Forum Discussion
Need help with summarizedcolumns
I have a table that look like this:
I want a new table with this result:
Any suggestions?
- Anonymous5 years ago
Hi Dhjlm ,
You can create a calculated table as below:
sTable = SUMMARIZECOLUMNS ( 'Table'[Sales], "Monday", SUM ( 'Table'[Monday] ), "Tuesday", SUM ( 'Table'[Tuesday] ), "Wednesday", SUM ( 'Table'[Wednesday] ), "Thursday", SUM ( 'Table'[Thursday] ), "Friday", SUM ( 'Table'[Friday] ) )But I have one doubt, why didn't you create a table visual directly without creating any measure or calculated table just like below screenshot?
Best Regards
4 Replies
- Fowmy
Super User
Dhjlm
You can easily summarize in Power Query.Create a blank Query, go to the Advanced Editor, clear the existing code, and paste the codes give below and follow the steps.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk7MSVXSUfLNz0tJrAQyQkpTiyGs8NSUPBg7JKO0CMp0K8oEMWJ1IHqLFQyBgoYGBjhJ2qo0AooYgcWxk7RVaQwUMQaLYydpojIWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t, #"(blank).4" = _t, #"(blank).5" = _t]), #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Monday", Int64.Type}, {"Tuesday", Int64.Type}, {"Wednesday", Int64.Type}, {"Thursday", Int64.Type}, {"Friday", Int64.Type}}), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Sale"}, "Attribute", "Value"), #"Grouped Rows" = Table.Group(#"Unpivoted Other Columns", {"Sale", "Attribute"}, {{"Total ", each List.Sum([Value]), type number}}), #"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[Attribute]), "Attribute", "Total ", List.Sum) in #"Pivoted Column"________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
- ibarrau
Super User
Hi. Can you specify a bit more about it? it doesn't make any sense the request. If you want that on a Power Bi Visualization, just add a matrix/table and add the values. Power Bi aggregates values automatically and it will group by non numerical columns like "Sales 1".
If you have a data sorce that you want to transform for your data model you can do it in the Transform Data menú like this:
Please explain more about it so we can help you.
Hope the message helps,
- DhjlmFrequent Visitor
Normally I would use
SUMMARIZECOLUMNS(Table[Sales];"Monday";SUM(Tables[Monday]
But that only works on one column, i would to sum monday - friday
- AnonymousNot applicable
Hi Dhjlm ,
You can create a calculated table as below:
sTable = SUMMARIZECOLUMNS ( 'Table'[Sales], "Monday", SUM ( 'Table'[Monday] ), "Tuesday", SUM ( 'Table'[Tuesday] ), "Wednesday", SUM ( 'Table'[Wednesday] ), "Thursday", SUM ( 'Table'[Thursday] ), "Friday", SUM ( 'Table'[Friday] ) )But I have one doubt, why didn't you create a table visual directly without creating any measure or calculated table just like below screenshot?
Best Regards