Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Sum Rows By Month Withour Group

Hey,

 

I Work with different langaue so I put a text box with english translation.

 

I Want to create with M langaue, a calculated column that will calculate the total LOG column by month, but the Group column will stay (without group again).

 

Which function can I use? I want to create this column for calculating the percentage of each group by each month from the total hours of the month.

 

Thanks!

 

**At the picture I meant to "Monthly Houres Per Month"

 

Itay_0-1609241055123.png

 

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

@Anonymous 

Place the following M code in a blank query to see the steps.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk4tKEnNTUotUtJRcgRiCyMLc6VYHVQJJyA2NzUyA0v4J5fkI9SbW1oYogmDVRsZWIKF/fLLkI23NDQyRhcHqbc0MTQBi7ukJqOoNzHBEAepNzW3sFCKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, Group = _t, #"LOG Hours" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type text}, {"Group", type text}, {"LOG Hours", Int64.Type}}),

    #"Grouped Rows" = Table.Group(#"Changed Type", {"Month"}, {{"Count", each _}, {"Sum", each List.Sum([LOG Hours]), type nullable number}}),
    #"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Group"}, {"Group"})
in
    #"Expanded Count"

 

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

5 REPLIES 5
AlB
Community Champion
Community Champion

@Anonymous 

Place the following M code in a blank query to see the steps.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk4tKEnNTUotUtJRcgRiCyMLc6VYHVQJJyA2NzUyA0v4J5fkI9SbW1oYogmDVRsZWIKF/fLLkI23NDQyRhcHqbc0MTQBi7ukJqOoNzHBEAepNzW3sFCKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, Group = _t, #"LOG Hours" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type text}, {"Group", type text}, {"LOG Hours", Int64.Type}}),

    #"Grouped Rows" = Table.Group(#"Changed Type", {"Month"}, {{"Count", each _}, {"Sum", each List.Sum([LOG Hours]), type nullable number}}),
    #"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Group"}, {"Group"})
in
    #"Expanded Count"

 

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

AlB
Community Champion
Community Champion

@Anonymous 

Either. If you're going for the excel file, you have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Anonymous
Not applicable
AlB
Community Champion
Community Champion

Hi @Anonymous 

You can do this with Group By

Can you share the contents of the table in text format, so that it can be copied and we can provide an exact solution

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Anonymous
Not applicable

Hey,

 

In Excel file? or just write it here?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.