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
HabibAdil
Helper IV
Helper IV

Replace Values Match Entire Cell Contents with Varying Column Numbers

Hi Members, Can you please help with the following.


I have a csv file (screenshot below) generated from ERP where the number of columns changes depending on the number of ERP users. The file shows user rights for different functions of the ERP. Instead of user 1 etc, the file will have named people. I only want to see Y in the user column if the user has rights else shows empty. I did this using function replace values with Match Entire Cell Contents and applied to all columns in the table. The replace values is applied to named column and when those columns are no longer there, I get an error. I need to apply replace values to entire table without power bi selecting the named columns.

 

Also I need to use some sort of indexing rather than named user so when the user is no longer there, my outcome table does not give me an error.

Thanks, Habib

 

Replace values.PNG

1 ACCEPTED SOLUTION

Hi@amitchandak, Thank you!!!!

Only need to use the below section of your suggestion with some tricks from the following video and it worked. BTW the video suggested to use Marix, but mine worked with table.

 

Select the first 4 columns, and use unpivot other columns, You will two columns attribute and value, in the value column replace N with null

 

https://www.youtube.com/watch?v=Bt_m5eVlUhA

View solution in original post

4 REPLIES 4
HabibAdil
Helper IV
Helper IV

Hi@amitchandak, Thank you for your respone. The suggestion only deals with the first half of my question. 
The data cannot refresh/import if the number of columns in import changes i.e. I had 10 users and now I only have 6 users. Furthermore, User column positions might have changed i.e. I might have user 2 in the fifth column instead of user 1.


Hi@amitchandak, Thank you!!!!

Only need to use the below section of your suggestion with some tricks from the following video and it worked. BTW the video suggested to use Marix, but mine worked with table.

 

Select the first 4 columns, and use unpivot other columns, You will two columns attribute and value, in the value column replace N with null

 

https://www.youtube.com/watch?v=Bt_m5eVlUhA

amitchandak
Super User
Super User

@HabibAdil , Select the first 4 columns, and use unpivot other columns, You will two columns attribute and value, in the value column replace N with null and then pivot the columns again with the aggregation option as MAX

 

 

https://radacad.com/pivot-and-unpivot-with-power-bi
Transpose : https://yodalearning.com/tutorials/power-query-helps-transposing-data/
Append : https://radacad.com/append-vs-merge-in-power-bi-and-power-query

 

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

The questions is how to dynamically adjust my output table so when I refresh the data, the number of columns increase or decrease based on the data in csv file. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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 Solution Authors