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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Variable inside count function

Why will the count function not return a result when a variable referring to a column is used as the parameter?

Loan_listing:

LOAD

LOAN_NUMBER,

     PRODUCT,

     PROD_DESC,

     CURRENCY as loan_currency,

     Evaluate(AMOUNT) as loan_amt,

     'Loans' as Data

FROM

[parsed parameters\loanlisting.qvx]

(qvx);

let name = FieldName(1, 'Loan_listing');

let nom = count(FieldName(1, 'Loan_listing'));

why is nom always empty? shouldn't it have the count of LOAN_NUMBER?

1 Solution

Accepted Solutions
HirisH_V7
Master
Master

Count and Sum will not work directly. we need use it like this,

Data_New:
Load
Count(YourField) as count
Resident Data Group By OtherField or currentField;

Then you need to call that count field into a , let variable using peek.

HirisH

View solution in original post

7 Replies
HirisH_V7
Master
Master

Try using this,

let nom = FieldValuecount(FieldName(1, 'Loan_listing')); 

-Hirish

HirisH
Sergey_Shuklin
Specialist
Specialist

Hello!

Try this functions:

LET nom = NoOfRows('Loan_listing') //for all rows

LET nom = FieldValueCount('LOAN_NUMBER') //for distinct values of the field

HirisH_V7
Master
Master

Bro, 'NoOfRows' it will not be allowed prior to Fieldname Function.

HirisH
Sergey_Shuklin
Specialist
Specialist

Hello!

I didn't use it with Fieldname() function.

Anonymous
Not applicable
Author

Your answer works but why won't click accept fieldname() inside of count?

HirisH_V7
Master
Master

Yup!  But he wants it with specified field.

HirisH
HirisH_V7
Master
Master

Count and Sum will not work directly. we need use it like this,

Data_New:
Load
Count(YourField) as count
Resident Data Group By OtherField or currentField;

Then you need to call that count field into a , let variable using peek.

HirisH