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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
inglexjc
Post Patron
Post Patron

Separate names in columns based on Role in separate column.

Current table V_TRAILS_CASE_CATEGORY shows:

 

CAS_IDD_STF_PERS_NMEROLE
1234One, TechPrimary
1235Two, TechSecondary
1236Three, TechPrimary
1237Two, TechSecondary

 

I would like it to show as:

CAS_IDPrimarySecondary
1234One, Tech 
1235 Two, Tech
1236Three, Tech 
1237 Two, Tech
1 ACCEPTED SOLUTION
marcelsmaglhaes
Super User
Super User

Hey @inglexjc 

 

In Power Query you should select the ROLE column in your query, and then, in Transform menu, choose the Pivot Column buton and copy the configuration of the image bellow.

marcelsmaglhaes_0-1701211086392.png

After you fill the option, click in OK. You will see the result you are looking for.

marcelsmaglhaes_1-1701211133991.png

 


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



View solution in original post

4 REPLIES 4
marcelsmaglhaes
Super User
Super User

Hey @inglexjc 

 

In Power Query you should select the ROLE column in your query, and then, in Transform menu, choose the Pivot Column buton and copy the configuration of the image bellow.

marcelsmaglhaes_0-1701211086392.png

After you fill the option, click in OK. You will see the result you are looking for.

marcelsmaglhaes_1-1701211133991.png

 


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



ExcelMonke
Super User
Super User

You could try the following, by creating a new table. Go to modeling, create table with the following DAX:

 

 

Union(
SELECTCOLUMNS(Filter('Table','Table'[D_STF_PERS_NME]="One, Tech"),"CAS_ID",'Table'[CAS_ID],"Primary","One, Tech","Secondary",""), 
//Looks for all D_STF_PERS_NME with "One, Tech" and creates a column named "Primary" and for each matching ID will return a value of "One, Tech", and blank in the "Secondary" column.

SELECTCOLUMNS(Filter('Table','Table'[D_STF_PERS_NME]="Three, Tech"),"CAS_ID",'Table'[CAS_ID],"Primary","Three, Tech","Secondary",""), //Looks for all D_STF_PERS_NME with "Three, Tech" and creates a column named "Primary" and for each matching ID will return a value of "Three, Tech", and blank in the "Secondary" column.

SELECTCOLUMNS(Filter('Table','Table'[D_STF_PERS_NME]="Two, Tech"),"CAS_ID",'Table'[CAS_ID],"Primary","","Secondary","Two, Tech")//Looks for all D_STF_PERS_NME with "Two, Tech" and creates a column named "Primary" and for each matching ID will return a value of Blank, and "Two, Tech" in the "Secondary" column.

)

 

 

 

Hope this helps!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





I changed the names of the D_STF_PERS_NME to be One, Tech; Two, Tech; Three, Tech to protect PII.  what if there are REAL names that are different listed under D_STF_PERS_NME?

Hmm... you could try switching the filter clause to look at the role column and the selectcolumns clauses to return the D_STF_PERS_NME rather than a static value, although I have not tried this out myself yet. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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