Forum Discussion

Matthias's avatar
Matthias
Frequent Visitor
8 years ago
Solved

Unpivot Repeating Attribute Value Columns

Hi

 

I am working on a report in an IT context. I have a table 'Projects', the work of each project can be distributed according to several domains. Users enter this information in Domain - Distribution Percentage Fields. They have the option to select 5 domains and assign distribution percentages.

This leads to the following dataset.

 

IDDomain1Domain1 PercentageDomain2Domain2 PercentageDomain3Domain3 PercentageDomain4Domain4 PercentageDomain5Domain5 Percentage
1SAP20CRM20MES20Sharepoint20Server20
2MES80CRM20      
3SAP100        

 

How can I transform my dataset to achieve the underlying table?

 

IDDomainPercentage
1SAP20
1CRM20
1MES20
1Sharepoint20
1Server20
2MES80
2CRM20
3SAP100

 

 

  • In the Query Editor

    1) Ctrl+Select the 5 Domain Columns

    2) Transform tab - Unpivot Columns - select Unpivot Only Selected Columns

    3) Select the Value column - click the drop-down button in the column’s header - uncheck the Blank value

    4) Ctrl+Select the 3 columns - ID, Domain1 Percentage and Value

    5) Right-click on any one the selected columns’ Headers - select Remove Other Columns

    6) Finally rename the Domain1 Percentage column - Domain and the Value column - Percentage

    There it is! :smileyhappy:

     

1 Reply

  • Sean's avatar
    Sean
    Community Champion

    In the Query Editor

    1) Ctrl+Select the 5 Domain Columns

    2) Transform tab - Unpivot Columns - select Unpivot Only Selected Columns

    3) Select the Value column - click the drop-down button in the column’s header - uncheck the Blank value

    4) Ctrl+Select the 3 columns - ID, Domain1 Percentage and Value

    5) Right-click on any one the selected columns’ Headers - select Remove Other Columns

    6) Finally rename the Domain1 Percentage column - Domain and the Value column - Percentage

    There it is! :smileyhappy: