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
anelson
Regular Visitor

Make New Columns based on Cell Value to Flatten and Retain Data

I would like to flatten my data to just 1 row per Load Number.  But I have to make a new column for Stopoff and for Final Delivery locations.  Stopoff is notated by a D in Stop Type, and a Stop ID of 1 (sometimes there are multiple Stopoffs, with Stop IDs increasing in increments of 1 - ex. 1, 2, 3, 4).  Final Delivery is always notated by a D in Stop Type and a Stop ID of 999.

 

I have shown below a simplified example.  I will have to scale up the solution to make new columns for all relevant information of each location.

 

Thank you for any help!  First time posting...if there's a better way to ask questions going forward, please advise.

 

Aaron

 

Load NumberStop TypeStop IDLocation Type
963345P0Shipper
963345D1Stopoff
963345D999Final Delivery
963346P0Shipper
963346D1Stopoff
963346D999Final Delivery
963347P0Shipper
963347D999Final Delivery
1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@anelson,

Please check if Merge2  table returns your expected result in the following PBIX file.

https://1drv.ms/u/s!AhsotbnGu1NolAADVkhaKAdrTRpu

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yuezhe-msft
Employee
Employee

@anelson,

Please check if Merge2  table returns your expected result in the following PBIX file.

https://1drv.ms/u/s!AhsotbnGu1NolAADVkhaKAdrTRpu

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yes!  That's exactly what I need it to do. 

 

 

For the record, this is what Lydia did:

 

  1. Duplicated original data table
  2. Made the new tables filtered to one type of location (so now have tables with just "stopoff", "shipper", and "final delivery".
  3. Merged these queries into a new table (have to do twice to get all 3 types in one query).
  4. Expand the new columns!

 

Thank you Lydia!

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.

Top Solution Authors