Data shape transform - Groupby Transformation

Obaid Ur Rehman 86 Reputation points
2022-03-17T18:30:00.963+00:00

Hi,

I have a dataset which looks like:
184281-datashape.png
except that, there could be multiple columns col1-col500 and multiple output cols output1-output10. The image above shows only one col and two outputs. The outputs values are same but they might note be in real case.

I want to convert this data to somewhat like this format:

No    col1        number    output   
  1    10000       1           0.6288623  
  2    10000        2          0.6288623  
  3    10001        1          0.9900...  
  4    10001        2          0.9900...  

It is also possible that I have output5 and output7 (or any number), in that case it would look like this

   No    col1        number    output   
      1    10000       5           0.6288623  
      2    10000        7          0.6288623  
      3    10001        5          0.9900...  
      4    10001        7          0.9900...  

I have tried using conditional split but that doesnt serve the purpose.

After that, I intend to produce some group aggregates:

Group By Id and calculate output*sum(Value), Value is another float column. I have tried Aggregate activity, but it raises error that output should be part of GroupBy which doesnt make sense. Also, If I use expression $$ = first($$) then it returns only the first output for each groupby.

Thanks

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

Answer accepted by question author
  1. Nasreen Akter 10,891 Reputation points Volunteer Moderator
    2022-03-18T12:51:28.6+00:00

    Hi @Obaid Ur Rehman ,

    Wondering if the output are coming from the same dataset you have posted below:
    https://learn.microsoft.com/en-us/answers/questions/773711/combine-columns-from-multiples-csv-files-in-azure.html

    If yes, then the RANK before PIVOT activity will give you the expected result you are looking for here. Thanks!


0 additional answers

Sort by: Most helpful

Your answer

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