Forum Discussion

KelvinMorel's avatar
KelvinMorel
Helper II
1 year ago
Solved

Count occurrences from grouped Table column

Hi all, I have a large table of all customer's invoices, in "AANTAL DAGEN" column I count how many days are between invoice's expire date and invoice's paid date, from there I would like to extract ...
  • jgeddes's avatar
    1 year ago

    Something like the following might work for you...

    let
        Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        #"Removed Columns" = Table.RemoveColumns(Source,{"VERVALDATUM"}),
        #"Grouped Rows" = Table.Group(#"Removed Columns", {"KLANT", "NAAM", "CONTRACT"}, {{"Count", each Table.RowCount(_), Int64.Type}, {"All", each _, type table [BU=number, KLANT=text, NAAM=text, CONTRACT=text, FACTUUR=text, MONTH=text, AANTAL DAGEN=number]}}),
    #"Added Column" = Table.AddColumn(#"Grouped Rows", "Zeros Row Count", each Table.RowCount(Table.SelectRows([All], each [AANTAL DAGEN] = 0)))
    in
        #"Added Column"