cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dianhudayahr
Helper I
Helper I

Filter two criteria in one column Share Point in Data Table

Hello Everyone,

 

I have data share point list with name "Incoming".

and I have column "Work Place" with many value inside,

but I want to filter "Work Place" in two criteria (same column) and show in my data table, below here my code

Filter(
    Incoming,
    StartsWith(
        KodeID,
        TextInputKodeIDShi.Text
    ) && StartsWith(
        'Work Place',
        Label021.Text
    ) && StartsWith(
        'Work Place',
        Label029.Text
    )
)

 

So in my data table,  Power Apps didn't find any data..

Anyone know how to filter two criteria in same column? 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @dianhudayahr ,

Just some more bracketing required

Filter(
   Incoming,
   (
      IsBlank(TextSearchBox1.Text) || 
      StartsWith(
         KodeID,
         TextInputKodeIDShi.Text
      )
   ) &&
   (
      (
         IsBlank(Label021.Text) || 
         StartsWith(
            'Work Place',
            Label021.Text
         )
      ) || 
      ( 
         IsBlank(Label029.Text) ||
         StartsWith(
            'Work Place',
            Label029.Text
         )
      )
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

6 REPLIES 6
zmansuri
Super User
Super User

There is no point giving two criteria. If you have large dataset and want to filter on same columns. You can try this:

 

Filter(
Filter(
    Incoming,
    StartsWith(
        KodeID,
        TextInputKodeIDShi.Text
    ) && StartsWith(
        'Work Place',
        Label021.Text
    ) 
),StartsWith(
        'Work Place',
        Label029.Text
    )
)

 This will first give result from Lable021. and give this filtered list as a source to Lable1029.

Hi Zmansuri,

 

I think so, I already trying your code, and still cannot find any data.

it seem difficult with AND function also in filter same column, 

So I try combine with OR function in there filter,  below the code.

 

Filter(
    Incoming,
    StartsWith(
        KodeID,
        TextInputKodeIDShi.Text
    ) && StartsWith(
        'Work Place',
        Label021.Text
    ) || StartsWith(
        'Work Place',
        Label029.Text
    )
)

From there, I got a good result the data is show and working.
but still not perfect, because every I type item in -> TextInputKodeIDShi.Text its not working correctly, 

I still cant find out to solving this situation..

Anyone to know, please give advice.

 

Thank you very much.

 

 

StalinPonnusamy
Community Champion
Community Champion

Hi @dianhudayahr 

 

My assumption is to filter to use AND if search exists. The below code search KodeID and Work Place with 2 filter criteria.

With(
    {
        sData: Filter(
            Incoming,
            IsBlank(TextSearchBox1.Text) || StartsWith(
                KodeID,
                TextInputKodeIDShi.Text
            )
        )
    },
    If(
        !IsBlank(Label021.Text),
        Filter(
            sData,
            StartsWith(
                'Work Place',
                Label021.Text
            )
        ),
        If(
            !IsBlank(Label029.Text),
            Filter(
                sData,
                StartsWith(
                    'Work Place',
                    Label029.Text
                )
            ),
            sData
        )
    )
)

 Note: sData is just a variable to avoid delegation

Hi @dianhudayahr ,

Just some more bracketing required

Filter(
   Incoming,
   (
      IsBlank(TextSearchBox1.Text) || 
      StartsWith(
         KodeID,
         TextInputKodeIDShi.Text
      )
   ) &&
   (
      (
         IsBlank(Label021.Text) || 
         StartsWith(
            'Work Place',
            Label021.Text
         )
      ) || 
      ( 
         IsBlank(Label029.Text) ||
         StartsWith(
            'Work Place',
            Label029.Text
         )
      )
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi @WarrenBelz 

 

This one is totally working,, problem filter two criteria is solved!

Thank you..

hi @StalinPonnusamy 

 

This still show filter one criteria, solution is used more bracket required.. just check the latest reply.

Thank you friend.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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