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
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
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
Top Kudoed Authors