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
SebSchoon1
Post Patron
Post Patron

List of columns in Table.Addcolumn IF Then else

Hello fellows, I need a god like master to solve this

 

I have a Table into this step

 

#"Table Source" 

 

In this table i have some columns which contains "%" in the cells.

 

I Need to verify This for specific columns which can be changing over Time  But these are always Staring By "Column"

 

I have created a list to solve this 

 

= Table.ToList(Table.SelectRows(#"Converti en table", each Text.Contains([Column1], "Column")))

 

 

I would like to add a conditionnal column which check for each column name if they contains "%" in the Values.

 

So instead of [Column7] and [Column9] in this formula

 

= Table.AddColumn(#"Table Source", "Personnalisé", each if Text.Contains([Column7], "%") or Text.Contains([Column9], "%") then "A" else null)

 

I woul like something Like 

 

= Table.AddColumn(#"Table Source", "Personnalisé", each if Text.Contains("List of columns to Check", "%") then "A" else null)

 

 

 

Is this feasible?

 

Many thanks !

1 ACCEPTED SOLUTION

Hello,  I have changed the approach by unpivoting columns,

 

Ad conditional columns 

 

if (Text.contains, %) column [Valeur] and Column Attribute Text.StartsWith (Column) Then "RemiseDiscount"

 

then group by item 

 

add index column

conditional column => If Attributes = "Code article" then [Index]

Fill down

Group

Remove index volumn

Promote headers in nested tables

Table.combine

Unpivot columns

Conditional to check if a value in column [Attributes] contains Column AND column [Values] Contains sign  €  if yes then Price HT

 

Then group

index

conditional check

fill down 

group

table.combine

That's it

 

🙂

View solution in original post

3 REPLIES 3
wdx223_Daniel
Super User
Super User

if List.Contains({List of columns to check},"%",(x,y)=>Text.Contains(x,y)) then "A" else null

Hello,  I have changed the approach by unpivoting columns,

 

Ad conditional columns 

 

if (Text.contains, %) column [Valeur] and Column Attribute Text.StartsWith (Column) Then "RemiseDiscount"

 

then group by item 

 

add index column

conditional column => If Attributes = "Code article" then [Index]

Fill down

Group

Remove index volumn

Promote headers in nested tables

Table.combine

Unpivot columns

Conditional to check if a value in column [Attributes] contains Column AND column [Values] Contains sign  €  if yes then Price HT

 

Then group

index

conditional check

fill down 

group

table.combine

That's it

 

🙂

It does not work , 

 

Any chance to change the approach, and Merge any column from #"Table Source"  if in the list of columns representedby #"Personnalisé5"  which refers to columns i want to check in #"Table Source" We find the "%"

 

If yes, Then merge ?

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.