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
Super User
Super User

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.

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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,125)