Forum Discussion

PeeWhy's avatar
PeeWhy
Frequent Visitor
4 years ago
Solved

Best Practice to Consolidate a Table with Multiple Values

I am having a hard time wrapping my head around the best way to merge this data and looking for a best practice approach.

 

Here is a sample of some raw data in an imported CSV.  There are some common columns and uncommon ones.

CUSTOMER

CITYSTATEINVWEIGHT
Customer AHOUSTONTX37
Customer AHOUSTONTX55
Customer BDALLASTX1023
Customer BDALLASTX1532

 

 

I  am trying to consolidate into a single summed-up table summing the value like you would in excel SUMIF.  I have tried making a distinct list of the customer names but It keeps saying I have a many to many relationship and unable to sum the values.

 

What is the best way to take the above imported data and end up with a consolidated table like the below that I can report on?

 

CUSTOMER

CITYSTATEINVWEIGHT
Customer AHOUSTONTX812
Customer BDALLASTX2555

 

 

  • Considering Grouping the rows in PowerQuery.

    = Table.Group(#"Changed Type", {"CUSTOMER", "CITY", "STATE"}, {{"INV", each List.Sum([INV]), type nullable number}, {"WEIGHT", each List.Sum([WEIGHT]), type nullable number}})

     

3 Replies

  • jsaunders_zero9's avatar
    jsaunders_zero9
    Icon for Responsive Resident rankResponsive Resident

    Considering Grouping the rows in PowerQuery.

    = Table.Group(#"Changed Type", {"CUSTOMER", "CITY", "STATE"}, {{"INV", each List.Sum([INV]), type nullable number}, {"WEIGHT", each List.Sum([WEIGHT]), type nullable number}})

     

    • PeeWhy's avatar
      PeeWhy
      Frequent Visitor

      I have never done that before.  Thank you!  Would you still do that if it were a much larger table to clean up?  

      • v-xiaotang's avatar
        v-xiaotang
        Icon for Community Support rankCommunity Support

        Hi PeeWhy 

        if it were a much larger table, you can still use this way to clean up.

         

        Best Regards,

        Community Support Team _Tang

        If this post helps, please consider Accept it as the solution to help the other members find it more quickly.