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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
monojchakrab
Resolver III
Resolver III

Select column names from a list of column headers

Hello Good people,

 

This possible is a simple solution....

 

  • I have a list of all column headers as follows as a part of a step within a query :

monojchakrab_0-1667066666380.png

  • I will feed this list into another step but I dont want to carry all the columns. So I created another list for the column headers which I want to keep from the list above :

monojchakrab_1-1667066774430.png

  • I have tried to write a code as below :

List.Select(
FirstList,
(_)=> List.ContainsAll(FirstList,SecondList)
)

But this is giving an error....is there some other way to do this or is this code writted wrong and the syntax can be modified?

Any help much appreciated

Best regds.,

1 REPLY 1
Fowmy
Super User
Super User

@monojchakrab 

You can use List.Intersect function
List.Intersect( {FirstList,SecondList} )

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors