Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate the Total Number of Rows.

Hi ,

I am new to Qlikview.

I am facing one Problem.

in counting the Total Number of Rows. ..

What do you think calculated the Total Numnber of Rows. in the Table that i have Uploaded from excel.

Count($Rows) or NoOfRows() . Can you please guide me on this.

Regards

Raj

7 Replies
Not applicable
Author

Below line as part of the data load script will give you the total no of rows loaded in a table.

LET DATA_COUNT = NoOfRows('TABLE_NAME');

Not applicable
Author

Hello Raj

First, when you use the RowNo() function inside a table, it will change according to the number of rows you have in that table (not the stored table, the one display on the screen) so in your case you have two chart each of which has two bars, so the NoOfRows() will always be 2 in this case. I'm afraid I haven't used Count($Rows) so I cannot tell you how this one works.

What you can do though is to add RowNo() as LineNum to your LOAD Script statement so it would appear like this:



LOAD

Then, in your QVW Document you could use the expression =Max(LineNum) to give you the total count.

Good luck,

Nigel.

Date,IT,I,V,RowNo() AS LineNum FROM Bookw.xls (biff, embedded labels, table is Sheet1$);

Not applicable
Author

Not sure what's going on with this Forum at the moment, text keeps splitting up, in the above text, the Line starting with Date,IT,I,V....... should be after LOAD.

Nigel.

Not applicable
Author

Hi Thanks ,

I got some idea . But My problem is I wanted the No. of Rows for IT=x . (Say for Example)

The Data_count give only fixed value of the Total No.of Rows.

It should be fexible enough to calculate the No.of Rows based on the selection of IT (say IT='x' or IT='Y')

Regards

Raj.

Not applicable
Author

OK Raj

No we know what you would like, do this:

Count ( Total IS(IT='x' , 1 ) )

Cheers,

Nigel.

Not applicable
Author

Hi Nigel ,

Thanks for you help. A couple of Questions.

1. "Is" was giving me error so i replaced it with "IF" and it worked Fine. Just for my Curiosity , Can "Count" here will behave in the Same way as "SUM" as in the IF condition we are retuning "1" on condition success.

I am asking another question in a diffrent context. I am working with 100-200 MM record , I am worried if adding an extra column like RowNo() as lineNmber will hit the performance severly. Regards

Raj.

" I learn a lot for the discussion in Qlikview Forum "

Not applicable
Author

Hello Raj

First, the IS was my mistake, it certainly should have been IF so well done for spotting that one!!

Second, SUM would work in exactly the same way as count, again well done for spotting that one.

Next, I would always try to put as much logic as possible into the LOAD Script rather than expressions, the RowNo() should not impact performance much at all, moreover, I would also put in the logic for IF(IT='X',1) into the load script, this way the expressions only need to be a simple sum of a value. Calculated expressions have a far greater impact on performance than additional logic in the LOAD Script.

Regards,

Nigel.