cancel
Showing results for
Did you mean:
Level: Powered On

## First N with variable

Hi Experts,

is it possible to create lines [FirstN()] with a variable?

I have the follwing formula:

This formula is limited for 30 entries.

My idea:

Set(counter;DateDiff(DataCardValue13.SelectedDate;DataCardValue14.SelectedDate;Days))

This counter will give me the number of lines which have to be created.

Or is there a better way?

Thx

2 REPLIES 2
Community Support Team

## Re: First N with variable

Hi @dobroo,

Do you want to create lines via using a variable (a Number value) within the FirstN() function?

I have made a test on my side, I afraid that there is no way to achieve your needs in PowerApps currently.

The first argument of the FirstN function is required to provide a Table value rather than a Number value. More details about the FirstN function, please check the following article:

FirstN function

I agree with the first formula that you provided, I think it may be the only available solution to achieve your needs in PowerApps currently.

If you would like the idea you provided to be achieved in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Level: Powered On

## Re: First N with variable

Hi @v-xida-msft ,

Do you want to create lines via using a variable (a Number value) within the FirstN() function?

Yes. In the function now I have the (table)array from 0-29.

If I need more than 30 lines I have to fill the array manually

The required lines come from the function DateDiff()

I wanna create one entry for each day in a SP-List between two Dates (From, To). Now in the formula I create the required collection with this function

The Result:

DataCardValue13 = 13.02.2019

DateCardValue14 = 16.02.2019

Collection DateRange:

"Datum"                   Value

13.02.2019                0

14.02.2019                1

15.02.2019                2

16.02.2019                3

The limited Range (Table) between From-To is by 30 entries. I can expand it with the manual input as discribed above. As example FirstN[0;1;2;............................;31]...

My idea is that i calculate the required lines in the SP-List with the function DateDiff() as a Number variable. Then give the result (Number vaiable) as table in the FirstN() function.

Is this possible?

Best regards,

Announcements

#### Watch Sessions On Demand!

Continue your learning in our online communities.

#### PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

#### Top Community Contributors for July 2019

Let's thank our top community contributors

#### Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

#### Power Platform World Tour

Coming to a city near you

#### PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

#### Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

#### Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

#### Power Summit Australia 2019

August 20-23rd 2019

Top Kudoed Authors
Users Online
Currently online: 251 members 3,821 guests
Recent signins: