Forum Discussion

EricsonCosta93's avatar
EricsonCosta93
Frequent Visitor
7 years ago
Solved

Group collumns from the same table

Hello guys!  I'm new on Power BI and DAX, such in this community Currently I have a dataset with the following structure:   I have to group the ID 2, Project and Value collumns and repe...
  • jdbuchanan71's avatar
    7 years ago

    Hello EricsonCosta93 

    We can get to what you are looking for by doing some work in the PowerQuery editor.

    • Add a custom column for each of the 10 blocks of 5 fields that combines the 5 fields together with a delimeter. 

    Once we have all 10 blocks of data combined into 10 fields we can

    • Remove the original data fields
    • Unpivot the new fields
    • Split the field on the delimiter
    • Rename the split column

    Just our 2 id columns and 10 columns of combined data

    10 columns of combined data unpivoted

    Split on "|" then rename

    I created an example PBIX file with the 52 columns of data and the transformation steps for you to look at.

    https://www.dropbox.com/s/04g5s5grs88tain/unpivot%20example.pbix?dl=0

    If you go into Home > Edit Queries you will be able to see the transformation steps I appiled and if you click on each step it will show you what I did on that step.

    The main work is done in the "Add Custom" steps where I make the combining fields.  You can click on the gear next to the step to bring up the editor for that step.

    And here is an example of the final result

    Result used in a table in PowerBI