cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FacundoGorla
Resolver II
Resolver II

How to use a specific option from a choice column in a condition.

Hi! I don't know if I expressed myself correctly in the title.

 

I want to Filter the options in a dropdown that is based on a SP list choice column.

I'm using an If statement to show certain options only if certain registers from another list have a specific value in a choice column.

 

This is what I imagine it should work:

If(
Filter('List1', Column1 = "Yes").ChoiceColumn1 = Filter(Choices('List1'.ChoiceColumn1), Value = Option1),
Filter( Choices(List2.Choicecolumn2), Value = "opt 1" || Value "opt 2")
)

 

Sadly, it didn't and I can't understand why.

The problem seems to be in the condition of the If statement like I wasn't comparing the same type of data.

I can provide the real Code but I think it will be even more confusing to you.

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Microsoft
Microsoft

Hi @ FacundoGorla,

Are your "Column1" a Yes/No column or a Text column? If your "Column1" is a Yes/No column, I recommend you use "Column1 = true" inside the condition.

Also, since the output to the left filter() and right filter() of “=” is both table, we cannot use “=” to compare two table directly. You need to change to other data type to compare.

Because you compare two results inside a same list1, I assume you want to judge if there is a list item in list1 that meet this condition: “Column=“Yes” and “ChoiceColumn1=”Option1”. If I misunderstand, please correct me, If yes, you can use this formula:

!IsEmpty(Filter(list1, Column1 = true && ChoiceColumn1.Value = "Option1"))

You can also use this(this time,if() compares same data type):

IsEmpty(Filter(list1, Column1 = true).ChoiceColumn1) =IsEmpty(Filter(Choices(list1.ChoiceColumn1), Value = "Option1"))

For the complete formula try this:

If(

!IsEmpty(Filter(list1, Column1 = true && ChoiceColumn1.Value = "Option2")),  // if true, it means the items exist in list1 and will return below filter() results.

Filter(list2,Choicecolumn2.Value = "opt 1" || Choicecolumn2.Value = "opt 2")

)

Best Regards,

Allen

View solution in original post

2 REPLIES 2
mdevaney
Super User III
Super User III

@FacundoGorla 

You can Filter a Choices column by adding .Value to the end of the column name.

Filter('List1', ChoiceColumn1.Value = "Yes")

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

v-albai-msft
Microsoft
Microsoft

Hi @ FacundoGorla,

Are your "Column1" a Yes/No column or a Text column? If your "Column1" is a Yes/No column, I recommend you use "Column1 = true" inside the condition.

Also, since the output to the left filter() and right filter() of “=” is both table, we cannot use “=” to compare two table directly. You need to change to other data type to compare.

Because you compare two results inside a same list1, I assume you want to judge if there is a list item in list1 that meet this condition: “Column=“Yes” and “ChoiceColumn1=”Option1”. If I misunderstand, please correct me, If yes, you can use this formula:

!IsEmpty(Filter(list1, Column1 = true && ChoiceColumn1.Value = "Option1"))

You can also use this(this time,if() compares same data type):

IsEmpty(Filter(list1, Column1 = true).ChoiceColumn1) =IsEmpty(Filter(Choices(list1.ChoiceColumn1), Value = "Option1"))

For the complete formula try this:

If(

!IsEmpty(Filter(list1, Column1 = true && ChoiceColumn1.Value = "Option2")),  // if true, it means the items exist in list1 and will return below filter() results.

Filter(list2,Choicecolumn2.Value = "opt 1" || Choicecolumn2.Value = "opt 2")

)

Best Regards,

Allen

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (57,970)