cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vffdd
Responsive Resident
Responsive Resident

FirstN with a dynamic number

Is it possible to use the FirstN function with a dynamic number?

 

FirstN(Sort(Datasource, AmountColumn, Descending),10)  So I would like that 10 to be whatever the user types in.

 

I have tried putting a txtbox1.text  (with the text box set as a number) I've tried setting a variable when the text box is updated and using the variable.. but nothing so far.  I don't know whether it can be done? or whether I'm just very close but haven't gotten the sytnax right !!😁

 

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
_benatherton
Advocate I
Advocate I

@vffdd 

You are very close. Instead of "txtbox1.text", you should put "Value(txtbox1.Text)". This means it will be accepted as a number rather than a string.

View solution in original post

5 REPLIES 5
_benatherton
Advocate I
Advocate I

@vffdd 

You are very close. Instead of "txtbox1.text", you should put "Value(txtbox1.Text)". This means it will be accepted as a number rather than a string.

View solution in original post

eka24
Super User
Super User

Try this

FirstN(Sort(Datasource, AmountColumn, Descending), Value (TextBox1.Text)) 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Drrickryp
Super User
Super User

Hi @vffdd 

FirstN(Sort(Datasource, AmountColumn, Descending),Value(Textinput1.Text)) However, I prefer to use a slider to limit the user's options to a range of numbers.  In that case the formula would be 

 

 

FirstN(Sort(Datasource, AmountColumn, Descending),Slider1.Value)

 

 

slider.png One more tip.  If you still want to use the textbox to enter the value, change the format of the textbox to Number so that the user cannot enter anything else. number.png

@vffdd 

This code will work:

FirstN(Sort(Datasource, AmountColumn, Descending),Value(TextInput1.Text))


---
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."

vffdd
Responsive Resident
Responsive Resident

I like that option @Drrickryp  thank you, I might use that instead

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,915)