Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi all,
I have the following SAP data:
As you can see, the 4 rows of data is very similar, except for the partner column. Therefore, it would like to transform and group the data into a solution similar to the following:
Do you guys know wether this can be acheived through the Power Query?
Note: The data is only dummy data, and in the real dataset, i have mulitple notifactions with different numbers of partners (in the example above there is 4 partners, however, it can vary from 3-6 parterns.
In advance - thank you for your help
/Andreas
Solved! Go to Solution.
Hi,
This M code works
let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Notification", Int64.Type}, {"Typ", type text}, {"Create On", type date}, {"Material", type text}, {"Partner", type text}}),
    Partition = Table.Group(#"Changed Type", {"Notification"}, {{"Partition", each Table.AddIndexColumn(_, "Index",1,1), type table}}),
    #"Expanded Partition" = Table.ExpandTableColumn(Partition, "Partition", {"Typ", "Create On", "Material", "Partner", "Index"}, {"Typ", "Create On", "Material", "Partner", "Index"}),
    #"Added Prefix" = Table.TransformColumns(#"Expanded Partition", {{"Index", each "Partner " & Text.From(_, "en-IN"), type text}}),
    #"Pivoted Column" = Table.Pivot(#"Added Prefix", List.Distinct(#"Added Prefix"[Index]), "Index", "Partner")
in
    #"Pivoted Column"Hope this helps.
Hi,
This M code works
let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Notification", Int64.Type}, {"Typ", type text}, {"Create On", type date}, {"Material", type text}, {"Partner", type text}}),
    Partition = Table.Group(#"Changed Type", {"Notification"}, {{"Partition", each Table.AddIndexColumn(_, "Index",1,1), type table}}),
    #"Expanded Partition" = Table.ExpandTableColumn(Partition, "Partition", {"Typ", "Create On", "Material", "Partner", "Index"}, {"Typ", "Create On", "Material", "Partner", "Index"}),
    #"Added Prefix" = Table.TransformColumns(#"Expanded Partition", {{"Index", each "Partner " & Text.From(_, "en-IN"), type text}}),
    #"Pivoted Column" = Table.Pivot(#"Added Prefix", List.Distinct(#"Added Prefix"[Index]), "Index", "Partner")
in
    #"Pivoted Column"Hope this helps.
Hello, for your case, wouldn't it be better to divide it into a fact and dimension table?
Below is the deal I made:
Based on the data I created two tables
Then I created the relationship:
I understand that this way your analyzes will be much easier.
If you want to download the example file I created, follow the link:
https://github.com/roolsant/SOSPowerBI/blob/main/Transform_Data.zip
I hope I helped you.
Rodrigo Santos
https://www.linkedin.com/in/rodrigosanpbi/
 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
 
            | User | Count | 
|---|---|
| 80 | |
| 49 | |
| 35 | |
| 31 | |
| 30 |