Forum Discussion

Mic1979's avatar
Mic1979
Icon for Post Partisan rankPost Partisan
1 year ago
Solved

Count Occurence and Divide

Dear all,

 

I have the table in the following link:

https://docs.google.com/file/d/1x0EfK8yFfP3AKcuFiGLOV7SzbV-yz2Cn/edit?usp=docslist_api&filetype=msexcel

 

What I need to do is:

  1. Count the number of occurence for column "merged" (how many time each of the vlues is repeated)
  2. Divide the values in the column "Volumes" for the corresponding value found in the point 1.

Could you help me?

 

Thanks.

  • You may use below code

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Grouped Rows" = Table.Group(Source, {"Merged"}, {{"Count", each Table.RowCount(_)}, {"Result", each [Volumes]{0} / Table.RowCount(_)}})
    in
        #"Grouped Rows"

2 Replies

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Icon for Most Valuable Professional rankMost Valuable Professional

    You may use below code

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Grouped Rows" = Table.Group(Source, {"Merged"}, {{"Count", each Table.RowCount(_)}, {"Result", each [Volumes]{0} / Table.RowCount(_)}})
    in
        #"Grouped Rows"
    • Mic1979's avatar
      Mic1979
      Icon for Post Partisan rankPost Partisan

      Wow many thanks for your help.