Home

How to filter a datatable

%3CLINGO-SUB%20id%3D%22lingo-sub-376256%22%20slang%3D%22en-US%22%3EHow%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376256%22%20slang%3D%22en-US%22%3E%3CP%3EHow%20can%20i%20Filter%20a%20datatable%20in%20Powerapp%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20screen%20with%20a%20datatable%20with%203%20columns.%20Datatable%20is%20based%20on%20a%20sharepoint%20list%20that%20is%20connected%20to%20my%20powerapp.%3C%2FP%3E%3CP%3ETitle%20%7C%20Description%20%7C%20Status%3C%2FP%3E%3CP%3EI%20want%20to%20filter%20on%20status%3C%2FP%3E%3CP%3EStatus%20contain%20text%20and%20i%20want%20to%20filter%20on%20things%20that%20contain%20%22Ye%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20looked%20everywhere%2C%20it%20seems%20like%20ppl%20are%20able%20to%20filter%20a%20datatable.%20but%20i%20can%20not%20get%20it%20to%20work.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFilter('Underlag%20Kostnader'%3BStatus%3D%20%22Ye%22)%3C%2FP%3E%3CP%3EUnderlag%20Kostnader%20%3D%20my%20sharepoint%20list%3C%2FP%3E%3CP%3EStatus%20%3D%20status%20column%20in%20the%20datatable.%3C%2FP%3E%3CP%3EDatatable%20is%20caled%20%22Datatable1_1%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAbove%20code%20is%20placed%20in%20a%20%22onselect%22%20button.%20So%20idea%20is%20the%20when%20i%20press%20the%20button%2C%20the%20list%20is%20filtered.%3C%2FP%3E%3CP%3EIs%20this%20possible%20and%20if%20so%20how%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-376256%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-377950%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-377950%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869%22%20target%3D%22_blank%22%3E%40Chris%20Webb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20worked%20really%20good.%20I%20changed%20tactic%20after%20watching%20a%20few%20videos.%20I%20got%20a%20first%20filter%20working%20now.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20i%20need%20a%20bit%20of%20more%20help%20tho%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20line%20works%3C%2FP%3E%3CP%3EFilter('Underlag%20Kostnader'%3BTextInput1.Text%20in%20Beskrivning)%3C%2FP%3E%3CP%3EThe%20code%20is%20put%20on%20GALLERY%C2%B4s%20Items%3C%2FP%3E%3CP%3EScreenshot%3A%20%3CA%20href%3D%22http%3A%2F%2Fprntscr.com%2Fn0polx%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fprntscr.com%2Fn0polx%3C%2FA%3E%3C%2FP%3E%3CP%3ESo%20typing%20in%20TextInput1%20i%20filter%20the%20column%20called%20Beskrivning.%3C%2FP%3E%3CP%3EBut%20how%20can%20i%20now%20filter%20by%20searching%20in%20column%20Rubrik%20with%20TextInput1_1%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20just%20double%20the%20code%20like%20this%3A%3C%2FP%3E%3CP%3EFilter('Underlag%20Kostnader'%3BTextInput1.Text%20in%20Beskrivning)%26amp%3BFilter('Underlag%20Kostnader'%3BTextInput1_1.Text%20in%20Rubrik)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20it%20did%20not%20work.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-377920%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-377920%22%20slang%3D%22en-US%22%3EMy%20recommendation%20to%20you%20is%20go%20yo%20youTube%20and%20search%20for%20Shane%20young%20powerapps%20and%20whatch%20his%20videos%20around%20filter%20and%20lookup%20and%20a%20few%20others%20surrounding%20the%20topic.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-377919%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-377919%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869%22%20target%3D%22_blank%22%3E%40Chris%20Webb%3C%2FA%3EI%20dont%20get%20it...%20where%20do%20i%20put%20what%20code%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ei%20created%20a%20textbox%20and%20typed%20in%20this%3C%2FP%3E%3CP%3EFilter('Underlag%20Kostnader'%3BStatus%3BTextInput1.Text)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eput%20on%20the%20textbox%20onchange%20and%20tried%20the%20onselect%3C%2FP%3E%3CP%3Etextbox%20dont%20have%20a%20Item%20to%20put%20anything%20on%20so%20i%20dont%20know%20where%20to%20put%20the%20code%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%22underlag%20kostnader%22%20%3D%20sharepoint%20list%20and%20datasource%3C%2FP%3E%3CP%3Estatus%20%3D%20column%3C%2FP%3E%3CP%3Etextinput1%20%3D%20textbox%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376486%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376486%22%20slang%3D%22en-US%22%3EOh%20now%20that%20you%20say%20that%20I%20see%20the%20issue%2C%20I%20should%20have%20caught%20on%20with%20the%20original%20post.%20You%20can't%20use%20filter%20onselect%2C%20you%20basically%20have%20to%20take%20your%20gallery%20items%20property%20is%20where%20you%20set%20your%20filter%20and%20you%20need%20to%20set%20it%20there.%20%3CBR%20%2F%3E%3CBR%20%2F%3EBasically%20you%20need%20to%20have%20a%20filter%20value%20either%20via%20Textbox%2C%20or%20from%20another%20gallery%20and%20set%20the%20filter%20value%20to%20that.%20So%20if%20you%20create%20a%20textbox%20to%20put%20your%20filter%20in%20then%20this.%20%3CBR%20%2F%3E%3CBR%20%2F%3EFilter(%3CBR%20%2F%3E%20Inventory%2C%3CBR%20%2F%3E%20Columnname%2C%3CBR%20%2F%3E%20textbox.text%3CBR%20%2F%3E%20)%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20when%20you%20input%20that%20value%20into%20the%20Textbox%20you%20get%20the%20filter.%20You%20can%20create%20a%20manual%20drop%20down%20box%20as%20well%2C%20but%20if%20you%20need%20all%20values%2C%20then%20you%20have%20to%20use%20an%20IF%20statement%20in%20the%20items%20field%20saying%20IF%20it's%20blank%20then%20this%2C%20else%20use%20the%20filter%20so%20%3CBR%20%2F%3E%3CBR%20%2F%3EIf(textbox.text%20%3D%20%22%22%2C%20'datasource'%2C%20Filter('datasource'%2Ccolumntofilter%20%3D%20textbox.text)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376480%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376480%22%20slang%3D%22en-US%22%3EStill%20nothing.%3CBR%20%2F%3ETried%20your%20last%20code%20aswell.%3CBR%20%2F%3ETho%20im%20not%20sure%20what%20you%20mean%20by%20drop%20downs%20in%20powerapps%3F%3CBR%20%2F%3EThis%20is%20my%20first%20app..%20my%20idea%20is%20to%20use%20a%20button%20to%20activate%20a%20filter%2C%20but%20if%20there%20is%20a%20better%20way%20im%20open%20for%20it.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376468%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376468%22%20slang%3D%22en-US%22%3EPossible%20that%20it's%20multi%20choice%20value%3F%20%3CBR%20%2F%3EFilter(SharePointListName%2C%22SearchValue%22%20in%20Choice.Value)%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376467%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376467%22%20slang%3D%22en-US%22%3EI%20was%20thinking%20in%20terms%20of%20drop%20downs%20in%20powerapps.%20It%20should%20just%20let%20you%20filter%20on%20that%20the%20way%20you%20did%20it%2C%20did%20it%20give%20an%20error%20that%20way%20or%20it%20just%20doesn't%20return%20anything%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376460%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376460%22%20slang%3D%22en-US%22%3EThat%20did%20not%20work%20either.%3CBR%20%2F%3EFilter('Underlag%20Kostnader'%3BType.value%3D%22Ye%22)%3CBR%20%2F%3E%3CBR%20%2F%3EI%20get%20the%20error%20telling%20me%20that%20i%20cant%20use%20the%20%22.%22%20(dot).%3CBR%20%2F%3ETried%20%3B%20and%20%3A%20aswell...%20no%20luck%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376452%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20filter%20a%20datatable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376452%22%20slang%3D%22en-US%22%3EDepends%20on%20if%20you're%20passing%20in%20any%20values%20from%20other%20controls%2C%20but%20If%20mind%20serves%20right%20you%20need%20to%20use%20.value%20after%20Status%2C%20so%20Filter('datasource'%3BStatus.Value%20%3D%20%22Ye%22)%3CBR%20%2F%3E%3CBR%20%2F%3EGive%20that%20a%20whirl.%3C%2FLINGO-BODY%3E
Highlighted
Frequent Contributor

How can i Filter a datatable in Powerapp?

 

I have a screen with a datatable with 3 columns. Datatable is based on a sharepoint list that is connected to my powerapp.

Title | Description | Status

I want to filter on status

Status contain text and i want to filter on things that contain "Ye"

 

I have looked everywhere, it seems like ppl are able to filter a datatable. but i can not get it to work.

 

Filter('Underlag Kostnader';Status= "Ye")

Underlag Kostnader = my sharepoint list

Status = status column in the datatable.

Datatable is caled "Datatable1_1"

 

Above code is placed in a "onselect" button. So idea is the when i press the button, the list is filtered.

Is this possible and if so how?

 

9 Replies
Highlighted
Depends on if you're passing in any values from other controls, but If mind serves right you need to use .value after Status, so Filter('datasource';Status.Value = "Ye")

Give that a whirl.
Highlighted
That did not work either.
Filter('Underlag Kostnader';Type.value="Ye")

I get the error telling me that i cant use the "." (dot).
Tried ; and : aswell... no luck

Highlighted
I was thinking in terms of drop downs in powerapps. It should just let you filter on that the way you did it, did it give an error that way or it just doesn't return anything?
Highlighted
Possible that it's multi choice value?
Filter(SharePointListName,"SearchValue" in Choice.Value)
Highlighted
Still nothing.
Tried your last code aswell.
Tho im not sure what you mean by drop downs in powerapps?
This is my first app.. my idea is to use a button to activate a filter, but if there is a better way im open for it.
Highlighted
Oh now that you say that I see the issue, I should have caught on with the original post. You can't use filter onselect, you basically have to take your gallery items property is where you set your filter and you need to set it there.

Basically you need to have a filter value either via Textbox, or from another gallery and set the filter value to that. So if you create a textbox to put your filter in then this.

Filter(
Inventory,
Columnname,
textbox.text
)

So when you input that value into the Textbox you get the filter. You can create a manual drop down box as well, but if you need all values, then you have to use an IF statement in the items field saying IF it's blank then this, else use the filter so

If(textbox.text = "", 'datasource', Filter('datasource',columntofilter = textbox.text)
Highlighted

@Chris WebbI dont get it... where do i put what code?

 

i created a textbox and typed in this

Filter('Underlag Kostnader';Status;TextInput1.Text)

 

put on the textbox onchange and tried the onselect

textbox dont have a Item to put anything on so i dont know where to put the code

 

"underlag kostnader" = sharepoint list and datasource

status = column

textinput1 = textbox

 

Highlighted
My recommendation to you is go yo youTube and search for Shane young powerapps and whatch his videos around filter and lookup and a few others surrounding the topic.
Highlighted

@Chris Webb 

That worked really good. I changed tactic after watching a few videos. I got a first filter working now.

 

Now i need a bit of more help tho :)

 

This line works

Filter('Underlag Kostnader';TextInput1.Text in Beskrivning)

The code is put on GALLERY´s Items

Screenshot: http://prntscr.com/n0polx

So typing in TextInput1 i filter the column called Beskrivning.

But how can i now filter by searching in column Rubrik with TextInput1_1?

 

I tried just double the code like this:

Filter('Underlag Kostnader';TextInput1.Text in Beskrivning)&Filter('Underlag Kostnader';TextInput1_1.Text in Rubrik)

 

But it did not work.