• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Power BI Query

Bomino

Member
Hi,
I am learning M Language and I really need help: I have the following 2 Power BI queries and I was wondering if it is possible to combine them into one.
Query#1:
Code:
let
    Source = myfile,
    #"Grouped Rows" = Table.Group(Source, {"Column1", "Column2", "Column3", "Column4"}, {{"Count",each List.Count(List.Distinct([Column5])),Int64.Type}})
in
    #"Grouped Rows"
And query#2:
Code:
 let
    Source = myfile,
    #"Grouped Rows" = Table.Group(Source, {"Column1", "Column2", "Column3", "Column4"}, {{"TotalSum", each List.Sum([Column6]), type number}})
 in
    #"Grouped Rows"
Any help is greatly appreciate. Thanks.
 

Chihiro

Excel Ninja
Try replacing #"Grouped Rows" step with following.
Code:
    #"Grouped Rows" = Table.Group(Source, {"Column1", "Column2", "Column3", "Column4"}, {{"Count", each List.Count(List.Distinct([Column5])), type number}, {"TotalSum", each List.Sum([Column6]), type number}})
 
Top