cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Eric_Speicher
Frequent Visitor

Using Lookup in matrix (row & column) for default value

In a form to add new data, I have defaults values set in a data source.  I would like to populate the Default value, but I cannot seem to find the syntax of the Lookup formula.

 

My data source (SP) looks like this:

IndustryList

IndustryTopic1Topic2
Industry112
Industry234

 

The topic is known from the data card that is being entered on the form.  The Industry value comes from a previously selected dropdown.

 

I expected to set Default to something like:

Lookup(IndustryList, Industry = ThisItem.Industry, Topic1)

 

However, I am not getting close to whatever syntax the Lookup formula requires and cannot find any documentation, or other community questions.

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @Eric_Speicher ,

 

If you want to set the Default value of the Topic1 field based on the selected Industry value when creating a new record, maybe you could try as follows.

 

If(Form1.Mode=FormMode.New,LookUp(IndustryList, Industry.Value = DataCardValue2.Selected.Value, Topic1),Parent.Default)

 

vyujincuimsft_1-1664334232867.png

 

vyujincuimsft_0-1664334207983.png

In addition, here is a link for your reference.

https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-filter-lookup#syntax

 

 

Best Regards,

Charlie Choi

View solution in original post

2 REPLIES 2
v-yujincui-msft
Community Support
Community Support

Hi @Eric_Speicher ,

 

If you want to set the Default value of the Topic1 field based on the selected Industry value when creating a new record, maybe you could try as follows.

 

If(Form1.Mode=FormMode.New,LookUp(IndustryList, Industry.Value = DataCardValue2.Selected.Value, Topic1),Parent.Default)

 

vyujincuimsft_1-1664334232867.png

 

vyujincuimsft_0-1664334207983.png

In addition, here is a link for your reference.

https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-filter-lookup#syntax

 

 

Best Regards,

Charlie Choi

Hello @v-yujincui-msft (Charlie),

 

Thank you for the response.  For me, Industry.Value did not work (I would receive an error indicating wrong use of a period) and I needed to refer to the value in the dropdown as DropDown.Selected.Industry, for the equality check to work.

 

I appreciate your thought to make the default value conditional, I changed this to the value being blank rather than the form status.

 

I further appreciate the link to the documentation, which my searching had failed to discover.

 

This worked for me: 

 

If(IsEmpty(Parent.Default),LookUp(IndustryList, Industry = DropDownIndustry.Selected.Industry, 'Topic1'),Parent.Default)

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (2,566)