Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

No. of lines in a certain table (no. of rows)

I have a straight table in one of the sheet. The straight table consist of 2 dimensions and 2 expressions. Each expressions has pretty long formula.

I created a summary sheet; intending to show the number of record found in the table mention earlier.

Originally, I use function "count" and try to combine the formula of the 2 expressions. It works but not all time. If I load the qlikview with different data set, the count does not always return the same number of lines in the straight table.

I wonder if there is any function that I can use to get the number of lines of a certain object in a qlikview?

Thanks.

Pound.

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

I'd guess something like this, assuming your table is suppressing null and zero:

sum(aggr(if(Expression1 or Expression2,1),Dimension1,Dimension2))

Replace "Expression1" and "Expression2" with your actual expressions from the straight table. Replace "Dimension1" and "Dimension2" with your actual dimensions from the straight table. To avoid repeating the expressions, consider storing them in a variable, and then using the variable in both places.

View solution in original post

13 Replies
Not applicable
Author

Hi,

For number of rows in a table you can use the function NoOfRows.

Regards,

Ravi

suniljain
Master
Master

you can use Noofrow or count(unique Filed in that table)

Not applicable
Author

Guys,

The function NoOfRows is useful when I want to use this function in the same table itself.

The aim here is when you have 10 tables in 10 different sheets - I want to create a single summary sheet (like a dashboard you can say), that summarize number of records found on each of those 10 tables.

If selection is made; then the number of rows of the affected tables will be changed as well.

Thanks for replying though.

johnw
Champion III
Champion III

I'd guess something like this, assuming your table is suppressing null and zero:

sum(aggr(if(Expression1 or Expression2,1),Dimension1,Dimension2))

Replace "Expression1" and "Expression2" with your actual expressions from the straight table. Replace "Dimension1" and "Dimension2" with your actual dimensions from the straight table. To avoid repeating the expressions, consider storing them in a variable, and then using the variable in both places.

Anonymous
Not applicable
Author

My preferens is to use macro with GetNoOfRows.
Should be triggerred by any select in this case

Not applicable
Author

Hi John,

When there's no selection, the value of the formula given does not show the correct number of rows from the straight table.

However, if I made a selection (for example by choosing a certain period), the result of the formula match all the time. I have 10 years to select and any combination so far results in accurate way.

But when no selection - the result differ.

Any other idea?

Not applicable
Author

Hi Michael,

Now even a more 'newbie' question for you.. Big Smile

I did created a macro before (the macro was found in this forum too); but I can't refer the variable created inside a macro and put that in my dashboard.

How do I pass the variable from macro to my sheet objects?

Anonymous
Not applicable
Author

Just refer by the variable name. You can show, for example, a text box with text like this (in the name of your variable is Var):
=Var
or
='Number of rows in table 1 = ' & Var
In chart expressions you can refer to it as Var, or $(Var).

johnw
Champion III
Champion III


poundesville wrote:
Hi John,
When there's no selection, the value of the formula given does not show the correct number of rows from the straight table.
However, if I made a selection (for example by choosing a certain period), the result of the formula match all the time. I have 10 years to select and any combination so far results in accurate way.
But when no selection - the result differ.
Any other idea?<div></div>


Hmmm, not sure why it's not working when there are no selections. But Michael's solution sounds more robust than what I was proposing anyway since it will refer to the actual object instead of trying to duplicate what the object is doing. So I'd just do that instead, I think.