cancel
Showing results for
Did you mean:

## 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

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.

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

#### Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

#### Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

#### June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (47,146)