Search code examples
excelpowerquerym

Find matching value in query based on text


I am building a table in power query and I want to find the matching value from a column in a row. Does anyone know how to do this? I import my source data with:

leagueDataSource = #"League Data All",

this gives me this table:

table

I then have a variable called:

leagueName = "Albania - Superliga",

and want to create another variable called activeSeason. How do I match the variable leagueName with the value in active Season ?


Solution

  • Found the answer myself :)

    leagueName = "name",
    a = List.PositionOf(leagueDataSource[League], leagueName, 0),
    leagueID = Number.ToText(leagueDataSource[Active Season]{a}),