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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Junaid11
Helper V
Helper V

Unpivot through M or ease

I have below dataset.

StudentCourse1Course2Course3Course1Course2Course1Course2Course3Course1Course2
James01/02/2019 12/08/2000Not CompliantNot CompliantYNY01/02/2021 
Jason28/09/202024/09/201911/09/2015CompliantNot CompliantNYY28/09/202224/09/2021
John17/05/201818/01/2017 Not CompliantNot CompliantNNN17/05/202018/01/2019
Jenny12/01/2021 08/09/2008Not CompliantCompliantYYY12/01/2023 
           
           
           
           
           

This data represents Student and courses they have done. First three course column shows courses and theie completeion date . Next two column shows Compliance of two courses. This goes on. I have done unpivot to see course name and their values in one column but my rows count has increased significantly. My columns have same course name but not all columns/course are repeating. Like course completion date is showing three course while compliance is showing for only two course. I want to see it as below outcome. 

JamesCourse101/02/2019Not CompliantY01/02/2021
JamesCourse2 Not CompliantN 
JamesCourse312/08/2000 Y 
JasonCourse128/09/2020CompliantN28/09/2022
JasonCourse224/09/2019Not CompliantY24/09/2021
JasonCourse311/09/2015 Y 
      

Please help the way it can be done. Either M code or any other solution.

Thanks

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Junaid11 

here is a wokaround for you . pls see the attachment below.





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

@Junaid11 

here is a wokaround for you . pls see the attachment below.





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

Proud to be a Super User!




amitchandak
Super User
Super User

@Junaid11 , In the first table which has course number, add a prefix or a suffix to give meeting what it is

 

StartDate Course1 StartDate  Course2 StartDate Course3 Compliant Course1 Compliant Course2 Status Course1 Status Course2 Status Course3 EndDate Course1 EndDate Course2

 

Now unpivot all these columns. https://radacad.com/pivot-and-unpivot-with-power-bi

 

Split by Delimiter (first only) into 2 column https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

 

the pivot again using the first column in this split

 

refer this if needed

https://kohera.be/power-bi/how-to-unpivot-twice/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.