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
Anonymous
Not applicable

Find a value accross multiple columns

see the attached image. how do I search for a value I know accross multiple columns and each column has multiple rows.  Tried some VLOOKUP type stuff but could not get the correct row to return.

 

Andy Ideas would be apprectiated! 🙂 

setup pic.png

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think it is not a good idea to look for [Name] in multiple Value.children columns, this will make your code complex. I suggest you to unpivot all Value.children columns to transform your table.

For reference: Unpivot columns

Rename new column headers and the new table looks like as below.

1.png

Measure:

Look for Value title by children =
CALCULATE (
    MAX ( 'Table'[Value title] ),
    FILTER ( ALL ( 'Table' ), 'Table'[Value.children.name] = MAX ( 'Table'[Name] ) )
)

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think it is not a good idea to look for [Name] in multiple Value.children columns, this will make your code complex. I suggest you to unpivot all Value.children columns to transform your table.

For reference: Unpivot columns

Rename new column headers and the new table looks like as below.

1.png

Measure:

Look for Value title by children =
CALCULATE (
    MAX ( 'Table'[Value title] ),
    FILTER ( ALL ( 'Table' ), 'Table'[Value.children.name] = MAX ( 'Table'[Name] ) )
)

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

vojtechsima
Memorable Member
Memorable Member

Hi, @Anonymous 
If I understand correctly, this should be quite simple with "MAXX" function:

 

FindValue = 
var __currentValue = Mapper[Name]
var __findChildren = MAXX(FILTER(Mapper, 
Mapper[Children1] = __currentValue || Mapper[Children2] = __currentValue || Mapper[Children3] = __currentValue || Mapper[Children4] = __currentValue || Mapper[Children5] = __currentValue || Mapper[Children6] = __currentValue), Mapper[Value])
return __findChildren

 

vojtechsima_0-1646666191130.png


Edit: 
My sample data aren't perfect after close inspection, but it will showcase the issue nonetheless.

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.