Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get the row count of a straight table

Does anyone know how to get the row count - the physical number of rows displayed in a striaght table? The count of primary key or the count using the dimensions doesnt work for my app. I have 2 tables using the same data. In one table, I show all the rows. So the physical count will match the count of primary key. But in the second table, I supress/hide some rows based on a condition. so the physical count will not match the count of primary key. Is there a way to show the number of rows that is physically visible on the table. I did a workaround using a macro. But I am looking for an alternative. Appreciate any help. Thanks.

9 Replies
Gysbert_Wassenaar

Something like: count(aggr( chartexpressionhere , dim1, dim2, ... , dimN)) where dim1, dim2 ... etc are the dimensions in your straight table and chartexpressionhere is the expression with the conditions used in your straight table.


talk is cheap, supply exceeds demand
Not applicable
Author

I have a lot of dimensions (30-40). It is more like a 'custom table' where the users can choose the dimensions that they want to add.

Gysbert_Wassenaar

If they select the dimensions from a field in a listbox then that's no problem. See attached example.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks for the QVW. It is helpful. I have 15 dimensions and 6 expressions by default and another 45 dimensions on a list box. The expressions have formula. I've attached a sample. I've only included 3 expressions and less dimensions here. I created a macro for both the tables and it works. But I want to achieve the same result without a macro. Appreciate your help.

I tried the below and it works. But I am supressing the zeroes in Table 2(in the attached example). The count shows all the '0' records also. I want it to show only the records that are visible.

 

count(DISTINCT PROFIT_CENTER_DESC & COMPANY_NAM & CONT_NUM & CONT_TY_DESC & UW_YR & EFF_DT & EXP_DT & INSURED_NAM & CLM_NUM & LOSS_DT & TECH_ID_NAM & STATUS_CD_DESC & CRNCY_CD

)

Not applicable
Author

You can add an expression that only contains the number 1, then enable "Full Accumulation" and set the Total Mode to "Sum of Rows". That will sum the number of actual records shown in the table and show the number in the total rows.

Not applicable
Author

Thanks. I already tried that. But I dont want to show the number 1 in the table. If I hide it, I wont get the count either. Is there a way to get that count in a variable and show it outside the table?

Not applicable
Author

Since you have multiple dimensions and expressions, there is no easy or elegant way to accomplish this. You'll have to check wether a dimension or expression is enabled and multiply all the diferent posibilities from that... Sorry but I think in this case your macro is your best option.

Not applicable
Author

Thank you for the example. It helped me a lot.

mukesh19
Contributor II
Contributor II

Is there any way to achieve it in Qlik sense