简体   繁体   中英

Power M Custom Pivot in Excel

I have a Power Query in Excel that looks something like this:

Name | Tips
Anne | 3.00
Anne | 2.00
Mary | 4.00
Mary | 2.50
Jane | 6.00
Jane | 3.30

This is the Power M code I am using:

#"Table Pivot" = Table.Pivot(#"Sorted Rows", {"Tips"},"Tips","Tips", List.Sum)

Right now I am getting this:

Name | Tips
Anne | null
Mary | null
Jane | null

This is what I want to see:

Name | Tips
Anne | 5.00
Mary | 6.50
Jane | 9.30

How can I make this happen in Power M? Any help is appreciated, I am still pretty new to Power M. I think there is something I am not understand or that I am missing. Thanks so much!

In Power Query (aka M), Table.Pivot is used to pivot a column, ie transpose values to columns (1 column for each of the text values in the column you are pivoting), egif you want a column for each name.

What you are looking for is Group By, as illustrated in the picture below, with the generated code displayed in the formula bar:

通过...分组

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM