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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Laosi
Regular Visitor

Moving Values of Several Rows within Column mostly empty to next Column

I just tried using Power Query, I have several Tables from different files, all have same structure and headers, then combine all of them in Power Query, now i want to move "blabla PER" and "blabla PBV"(Red Box) to Column "Stock Name" and its subsequent values(Green Box) to Column "Assets" so I can remove Column "Sector" and "Sub Industry Code". question of moving PerPbv 1.png

 The problem is while most table had empty values in column "Sector" and "Sub Industry Code", some tables had text and numbers within those columns which i don`t needed(I only needed values containing "(space)PER" and "(space)PBV" and its adjacent values, i tried using Conditional Column to make new column combining "blabla PER" and "blabla PBV"(Red Box) to Column "Stock Name", had both column (Sector and Stock Name) change type to text but it give me errors.

Please help 🙏

1 ACCEPTED SOLUTION
v-tsaipranay
Community Support
Community Support

Hi @Laosi ,

Thank you for reaching out to the Microsoft Fabric Community.

 

Your requirement is achievable in Power Query. You can restructure the summary rows (e.g., "Average PER", "Weighted Average PBV") from the Sector column into Stock Name, and move their corresponding values into the Assets column using the steps below:

 

Add a custom column to flag rows:

if Text.Contains([Sector], "PER") or Text.Contains([Sector], "PBV") then true else false

Create new columns:

  • New Stock Name:
if [IsSummaryRow] then [Sector] else [Stock Name]
  • New Assets:
if [IsSummaryRow] then [Assets] else [Assets]

 

Once you’ve created the new columns, delete the original columns: Sector, Sub Industry Code, Stock Name, and Assets. Then rename your new columns to Stock Name and Assets. Make sure the data types are correct for example, text for names and numbers for values. These steps will clean up your data and remove the extra columns you don’t need.

 

If you still face issues after trying this, please share a sample of your data as suggested by @lbendlin  so we can help you further.

 

If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.

 

Thankyou.

 

View solution in original post

3 REPLIES 3
v-tsaipranay
Community Support
Community Support

Hi @Laosi ,

Thank you for reaching out to the Microsoft Fabric Community.

 

Your requirement is achievable in Power Query. You can restructure the summary rows (e.g., "Average PER", "Weighted Average PBV") from the Sector column into Stock Name, and move their corresponding values into the Assets column using the steps below:

 

Add a custom column to flag rows:

if Text.Contains([Sector], "PER") or Text.Contains([Sector], "PBV") then true else false

Create new columns:

  • New Stock Name:
if [IsSummaryRow] then [Sector] else [Stock Name]
  • New Assets:
if [IsSummaryRow] then [Assets] else [Assets]

 

Once you’ve created the new columns, delete the original columns: Sector, Sub Industry Code, Stock Name, and Assets. Then rename your new columns to Stock Name and Assets. Make sure the data types are correct for example, text for names and numbers for values. These steps will clean up your data and remove the extra columns you don’t need.

 

If you still face issues after trying this, please share a sample of your data as suggested by @lbendlin  so we can help you further.

 

If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.

 

Thankyou.

 

Thank you for ur respond, i decided to move it manually in file sources so i can calculate market PER and PBV changing percentages as well, i`ll try it if i encounter same problem again in the future, any way thank you so much 🙏 

lbendlin
Super User
Super User

all have same structure and headers

doesn't sound like they do?

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Kudoed Authors