Pivotting unpivotted data in Power Query

Domenico Ieracitano 0 Reputation points
2024-05-30T18:21:31.1866667+00:00

Why can't I have the same number of records after pivotting unpivotted data in Power Query? Am I missing something?

Example:

Table.Pivot( Table.FromRecords({ [key = "x", attribute = "a", value = "r1"], [key = "x", attribute = "c", value = "r1"], [key = "x", attribute = "c", value = "r2"], [key = "y", attribute = "a", value = "r1"], [key = "y", attribute = "b", value = "r1"] }), {"a", "b", "c"}, "attribute", "value", List.Max <- aggregation function )

In this case, if I don't select to aggregate the data by any function available (Count, Count Distinct, Min, Max, Median) I get an error because "attribute = c" for "key = x" has multiple values associated with it. Wouldn't it be better to have those multiple values spread into distinct rows instead?

Thanks

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,619 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiajing Hua-MFST 6,910 Reputation points Microsoft Vendor
    2024-05-31T06:57:06.0966667+00:00

    Hi @Domenico Ieracitano

    I suggest you post a new thread in: https://community.fabric.microsoft.com/t5/Power-Query/bd-p/power-bi-services

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments