Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jh_dempsey
Frequent Visitor

Help with complex table transform

Hi All

I have the below table which i need to transform

DataObjectIdAttributeDefinitionIdNameValue
09B13831-6566-415B-858E-86A4E702AF5BDFC2E406-BBDA-46C8-BD56-1769A3504B863D Model ConfidenceUnconfident
09B13831-6566-415B-858E-86A4E702AF5BE88020E0-7F43-460D-BB71-E1FA7568DD593D Model FileMDM SQL Test.dwg
09B13831-6566-415B-858E-86A4E702AF5B6D33DECE-0898-483A-8222-5F375B266AEC3D Model Revision 
09B13831-6566-415B-858E-86A4E702AF5B503C84D4-976E-4288-8CC4-3CA88AA3AEDFAD4 Asset StatusDesign
09B13831-6566-415B-858E-86A4E702AF5B4791AD8E-F899-4BDB-B2B7-4D6AE4C36693Additional Asset Information 
09B13831-6566-415B-858E-86A4E702AF5B0C3F7BA3-FBB7-483F-82D6-446A97B0AA10AngleINCLINED
09B13831-6566-415B-858E-86A4E702AF5B47941AD2-6D90-471C-94E5-68B82A076F86Asset Location Text 
09B13831-6566-415B-858E-86A4E702AF5B37EA8051-7A1F-4ACA-B635-F95E80A9A42FClass IDGTVE
09B13831-6566-415B-858E-86A4E702AF5B79B9B4DA-0C1D-44F5-A5ED-DBF78C86978BCurrent Maintenance ContractRTMC South East
17480D19-86C8-4233-ADC3-63A677309AD6DFC2E406-BBDA-46C8-BD56-1769A3504B863D Model ConfidenceUnconfident
17480D19-86C8-4233-ADC3-63A677309AD6E88020E0-7F43-460D-BB71-E1FA7568DD593D Model FileMDM SQL Test.dwg
17480D19-86C8-4233-ADC3-63A677309AD66D33DECE-0898-483A-8222-5F375B266AEC3D Model Revision 
17480D19-86C8-4233-ADC3-63A677309AD6503C84D4-976E-4288-8CC4-3CA88AA3AEDFAD4 Asset StatusDesign
17480D19-86C8-4233-ADC3-63A677309AD64791AD8E-F899-4BDB-B2B7-4D6AE4C36693Additional Asset Information 
17480D19-86C8-4233-ADC3-63A677309AD647941AD2-6D90-471C-94E5-68B82A076F86Asset Location Text 
17480D19-86C8-4233-ADC3-63A677309AD60B750D72-D592-41C0-9783-35961C99A5F2Class IDLSTR
17480D19-86C8-4233-ADC3-63A677309AD679B9B4DA-0C1D-44F5-A5ED-DBF78C86978BCurrent Maintenance ContractRTMC South East

The DataObjectId column contains the Id of a "DataObject". Each data object has attributes associated with it, and each row in the table above contains the name of one of the attributes and its value.

In the example table ive given above, there are two DataObjectId's listed, and each DataObject has the same 9 attributes associated with it.

I want to transform the table so it ends up looking like this:

DataObjectId3D Model Confidence3D Model File3D Model RevisionAD4 Asset StatusAdditional Asset InformationAngleAsset Location TextClass IDCurrent Maintenance Contract
09B13831-6566-415B-858E-86A4E702AF5BUnconfidentMDM SQL Test.dwg Design INCLINEDGTVERTMC South East
17480D19-86C8-4233-ADC3-63A677309AD6UnconfidentMDM SQL Test.dwg Design  LSTRRTMC South East

The attribute names should become the column names. Each unique DataObjectId should be on its own row and the values for each attribute stored against the correct DataObject and in the column of the associated attribute name.

Can anyone help us with the steps I need to undertake to get the table in this format?

I want the M query code to be as dynamic as possible, so I don't want the attribute names to end up being hardcoded into any M query statement. The reason is that the first table I show above is first filtered to show DataObjectId's which are of the same "asset type" (i can switch what asset type it filters for by changing a parameter). If the attribute names end up being hardcoded into the M query statements, the query is likely to break when I switch to a different asset type which has a different set of attributes associated with it.

1 ACCEPTED SOLUTION
SteveCampbell
Memorable Member
Memorable Member

First, right click on AttributeDefinitionId and remove it.

 

Then, click on name, go to the transform tab, and select pivot.

Annotation 2019-08-20 190542.png

Select these settings:

 

Annotation 2019-08-20 190205.png

This will be dynamic, assuming the column names (name, value, AttributeDefinitionId ) stay the same

 

 

 

Love hearing about Power BI tips, jobs and news?
I love to share about these - connect with me!

Stay up to date on  linkedin-logo.png
Read my blogs on  powerbi.tips_.png

Remember to spread knowledge in the community when you can! tu.png



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



View solution in original post

1 REPLY 1
SteveCampbell
Memorable Member
Memorable Member

First, right click on AttributeDefinitionId and remove it.

 

Then, click on name, go to the transform tab, and select pivot.

Annotation 2019-08-20 190542.png

Select these settings:

 

Annotation 2019-08-20 190205.png

This will be dynamic, assuming the column names (name, value, AttributeDefinitionId ) stay the same

 

 

 

Love hearing about Power BI tips, jobs and news?
I love to share about these - connect with me!

Stay up to date on  linkedin-logo.png
Read my blogs on  powerbi.tips_.png

Remember to spread knowledge in the community when you can! tu.png



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.