Overview of LOOKUPVALUE Functions in power bi
In this article, we will talk about one important DAX function which is the LOOKUPVALUE function in power bi.
Now, let’s get started
We have two tables in our dataset.
- Employee Table
- Master Table for Country-State
Here, in the Employee table, I have the name of the State. Now, I want to derive the name of the country from the Master table. In order to achieve this requirement, I need to search for the name of the state from the “Employee table” and look into the “Master table” which will retrieve the name of the country from it. For that, we will use the LOOKUPVALUE function in Power BI.
Syntax for the LOOKUPVALUE function in power bi:
LOOKUPVALUE(Result_ColumnName, Search_ColumnName1, Search_Value1)
Here,
Result_ColumnName = Name of the column which you want to show as an end result. In our case, we want to display the name of the Country from the Master table.
Search_Column1 = Name of the column from where you want to find your keyword/string. In our case, we want to search the value of State from the Master table.
Search_Value1 = Name of the column or value which you want to use as LookUpValue search. In our case, we want to search for the state in the Employee table.
In short, State from the Employee table will look into State from the Master table and display the value of the Country from it.
Right now, we have the following table value from the Employee table.
Now, let’s apply following DAX formula to retrieve the country name.
Retrive country = LOOKUPVALUE(‘Master Table'[Country],’Master Table'[State],’Employee Table'[State])
Below is the result of the above DAX formula:
Conclusion
This is how we can prepare to use the LOOKUPVALUE() function in Power BI.
For any Help or Queries Contact us on info@crmonce.com or +919014146800
Related Articles:
https://www.crmonce.com/conditional-formatting-by-icons-in-power-bi/