Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
aveeeeeee7en
Specialist III
Specialist III

Last RowNo()

Hi Community

I have one Question on Rowno()

It is very easy to do calculations based on first Row by using If(Rowno()=1,Your expression)

Suppose if i want last row, what i would write in Expresssion:

if(Rowno()=?,Your expression)

What to write in Place of ?

Regards

Aviral

7 Replies
Not applicable

Nag,

i think, you may for example:

a) load your table with additional field = rowno()

next you may load the same table resident but order your data by this additional field descending.

in 2'nd step your last row will be first

jerem1234
Specialist II
Specialist II

I think maybe:

If(Rowno()=NoOfRows(),Your expression)


Hope this helps!

sundarakumar
Specialist II
Specialist II

U should use peek in this case.

lets say u have loaded the table as table1 and rowno() as rownumber.

use peek like

let variable1=peek('rownumber',-1,'table1');

now use a resident and use the variable1...

-1 denotes last row in the table(property of (peek)

0 represents 1sr row, 1 represents second.....

Hope this helps.

-Sundar

aveeeeeee7en
Specialist III
Specialist III
Author

Can you help me in the Attached Qvw.

Any Help would be Appreciated.

Regards

Aviral

jerem1234
Specialist II
Specialist II

Not sure what kind of sorting you are doing in your original table. Can you explain your logic of how you want to calculate your numbers? what kind of output are you looking for?

I can give you this:

=if(rowno()=NoOfRows(),Count(DISTINCT if(TrnType='MOB',CommonEmpCode)),below([Opening MOB]))

but it does not replicate the values in your original table, since they aren't in the reverse order. To figure out what formula you need, you need to figure out what kind of sorting you have in the table. Not sure if you'll be able to use above, below, rowno(). You might have to do something in the script.

Hope this helps!

aveeeeeee7en
Specialist III
Specialist III
Author

I want this:

Re: Logic

jerem1234
Specialist II
Specialist II

If thats the case, then the formula I gave you should work:

=if(rowno()=NoOfRows(),Count(DISTINCT if(TrnType='MOB',CommonEmpCode)),below([Opening MOB]))


Please find attached.