Pivot table without aggregation in dataflow

Petar Novakovic 41 Reputation points
2023-01-29T16:15:36.01+00:00

I am trying to pivot table without aggregation in dataflow.

From:

P1

To:

p2

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
0 comments No comments
{count} votes

Accepted answer
  1. MartinJaffer-MSFT 26,236 Reputation points
    2023-01-30T22:03:59.1633333+00:00

    @Petar Novakovic Hello and welcome to Microsoft Q&A.

    I understand you want to do a pivot transformation in ADF data flow. Without an aggregation.

    Unfortunately, it won't let us not choose an aggregation, so I've come up with next best options. These will still provide the desired output.

    From what I can see of your data, DaTm values are unique, or at least the combination of Location and DaTm, or Location + DaTm + ID. Since there appears to be only one Attr value per cell, the aggregation doesn't really matter.

    In Pivot Settings:

    1. Group by Columns: Location and DaTm
    2. Pivot Key: ID
    3. Pivoted Columns: either first(Attr) or toString(collect(Attr))

    Since there is only one Attr value, there is only one value for first to choose from, so it makes no difference. You could even use last if you wanted, it would make no difference.

    User's image

    If there was more than one Attr value, then toString(collect(Attr)) would get all of them and list them in the same cell.

    User's image

    For the pictures, the data I used was the first 8 rows of your data, with DaTm shortened for readability.

    I believe this still accomplishes your desired output. Does this help?

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.