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
alexmag92
Regular Visitor

Using filter in Query Editor especificing a cell from another table

Using filter in Query Editor with a value (text) from another table, especificing a cell from a column.

 

code from Advanced Editor (I cleaned some parts to simplify):

 

...
filter = (table1[column1]),              # Uses filter as cells(1,1) from table 1, how?
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each [column1] = filter), 
...

 

 

att,

Alexandre

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

If I understand you correctly, you want to know how to get the first value from a table.

 

You can use Table.FirstValue, syntax:

 

Table.FirstValue(table as table, optional default as any) as any

If you supply a default value, then this value will be returned if the table is empty.

 

Specializing in Power Query Formula Language (M)

View solution in original post

3 REPLIES 3
MarcelBeug
Community Champion
Community Champion

If I understand you correctly, you want to know how to get the first value from a table.

 

You can use Table.FirstValue, syntax:

 

Table.FirstValue(table as table, optional default as any) as any

If you supply a default value, then this value will be returned if the table is empty.

 

Specializing in Power Query Formula Language (M)

It works, using this:

 

= Table.SelectRows(#"Changed Type", each ([Group_Column] = Table.FirstValue(Table2)))

 

ty @MarcelBeug.

 

att,

Alexandre.

 

@MarcelBeug

 

Im trying to filter table1[Group_Column] with a value from the first row and column of table2[Filter_Column]

 

Table1

Group_ColumnDescription_Column
Group_ADescription1
Group_ADescription2
Group_BDescription3
Group_ADescription4

 

Table2

Filter_Column
Group_A

 

and when I put the code:

 

#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Group_Column] = Table2[Filter_Column]))

 

Came: 'This table is empty'

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.