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

How to count number of rows for each column in a table

Hi all

can one please tell me, is there a way or a function to count the number of rows for each column in a Table..

Thank you

Ganesh

8 Replies
sunny_talwar

May be look at the attached sample application

Anonymous
Not applicable
Author

Hi

you can check  with rowno()

But if you would like calculate rows with data only in column wise ? , it will be different .

tamilarasu
Champion
Champion

Like attached.?

Not applicable
Author

Thank you all for the quick responses.. I have see all the responses are chart based and based on row number..

But, i dont use the data into a chart, I will get the data from the database and and then store into a table using resident table..

I need number of rows for each column in the table..

so my table would be something like this, if i show it in a table box..

and my select statement will give the Tagname in a column, which gives the three different tagnames values one after the other, so, i am not sure, how many rows i will be getting every time i reload the application

TagName

Fill A Time

Fill B Time

Fill C Time

Tag A

06:00

Tag A

06:05

Tag A

06:09

Tag B

06:02

Tag B

06:03

Tag B

06:05

Tag B

06:06

Tag C

06:03

Tag C

06:05

Tag C

06:07

and my code for the above result is like the below..

NoConcatenate

  GetPOTime:

  SELECT TagName as TagsPOTime,

  DateTime as POTime

  FROM

  History

WHERE

  TagName IN$(vTagForPO)

  AND DateTime >= '$(vProdStartTime)'

  AND DateTime <= '$(vThisExecTime)'

  NoConcatenate

  FactGetPOChangeTime:

  LOAD

  TagsForPOTime,

  if(TagsForPOTime='Fill A',POTime,0) as Fill A Time,

  if(TagsForPOTime='Fill B',POTime,0) as Fill B Time,

  if(TagsForPOTime='Fill C',POTime,0) as Fill C Time

  Resident GetPOChangeTime;

Here, I need some function, which can calculate the number of rows for each column for Fill A Time, Fill B Time, Fill C Time

Thank you

Ganesh

Not applicable
Author

Hi Allu,

I want to calculate the rows with data only in column wise

Thanks

Ganesh

Anonymous
Not applicable
Author

Hi

try this in pivottable , expression ?

sum(TOTAL( RangeNumericCount(Fill A Time)))

Not applicable
Author

Hi Allu

I want expression which can be stored in a Let Variable..

I will use that variable in the script further..

I tried the above expression in a variable, I am getting syntax error

Thanks

Not applicable
Author

Hi All

I found FieldFValueCount function to count the number of records but funny thing is that, I am getting the correct number of rows in debug mode but getting a script line error when i reload straight away

i am unable to figure out, what is the problem

Thank you

Ganesh