cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SkiDK
Level 8

check if all values in column match

Hey everyone,

 

I have a table, in which there is a column 'C' where I want to check if all values in that column match "X" or if all values match "Y" (or in between, but that's the 'else' of course).

 

I have some difficulty to find the correct way to do it. I got a bit stuck with using a Switch case that contain a ForAll loop that each would compare the result to "X" or "Y", but then I just loop over every item independly. I could use two counts to add 1 everytime I encounter "X" or "Y" and check if one of the two matches the amount of records in the table. But it sounds a bit much to check this.

 

Is there a better way to do this? Am I maybe overlooking something? 

 

Thank you already

2 REPLIES 2
Community Support Team
Community Support Team

Re: check if all values in column match

Hi @SkiDK ,

 

Can you please share the related formula here? Also, did you mean that you want to check if all records in a gallery control include the letter "X" or "Y"?

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SkiDK
Level 8

Re: check if all values in column match

Hey @v-monli-msft thanks for the reply

 

I have a table from which I want to see if all records match a certain value or not. I have 3 situations, either all record fields are 'X', all record fields do not match or all record fields are 'Y' (see image below)

 

XY.PNG

 

In Powerapps, how can I check if all fields match 'X', or 'Y', or it does not match either.

 

I was thinking doing something like this, but I'm not sure if this will work:

 

If (
    ForAll( Filter(coll, "Value") = "X" )),
    Execute code X,
    ForAll( Filter(coll, "Value") = "Y" )),
    Execute code Y
)

It's how to check if all values match 'X' or 'Y' (or else nothing happens)

 

The 'X' and the 'Y' are examples for strings I want to check matches on.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,431)