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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Expression In Script

I have the below expression in the chart properties and I would like to add in the scrip. Can someone show me the best approach?

Expression in Chart - count({<Status={[Pended]}>}distinct ID)

how would that look in the scrip? Can I use a IF Statement, this is what I have below...


    
Count(IF(Status= 'Pended','')) as TotalPends

1 Solution

Accepted Solutions
24 Replies
sunny_talwar

May be something like this:

LOAD Count(Status),

          ChartDimensions

Resident ...

Group By Chart Dimensions

Where Status = 'Pended';

MK_QSL
MVP
MVP

Yes but don't forget to use Group By in your script..

Anonymous
Not applicable
Author

Count(IF(Status= 'Pended',distinct ID ) as TotalPends

I want to count distinct ids when a status = pended

Not sure how that would look in the script

MK_QSL
MVP
MVP

Data:

Load * From TableName;

Count:

Load COUNT(Distinct ID) as TotalCount;

Load ID Resident Data Where Status = 'Pended';

sunny_talwar

And if there is a particular dimension on which you want the count, then may be this:

Data:

Load * From TableName;

Count:

Load   Dimension,

          COUNT(Distinct ID) as TotalCount;

Load ID Resident Data

Group By Dimension

Where Status = 'Pended';

Anonymous
Not applicable
Author

I'm hoping the expression can be created within the initial load with Ifs

I have...

Table:

Load

xxxx,xxxx,xxx,xxx

//(Hundereds of Columns)

Count(distinct ids) as TotalIds,

Count(DISTINCT if(Status='Pended')) as TotalPends , (The syntax is not right)

xxxx

FROM

Group by

xxxx,xxxx,xxx,xxx xxxx;

sunny_talwar

I think it would be better to left join your result back to the original table, because I don't think this would work the way you are doing:

1st of all are you doing a overall count of ids where status is pending? or on a particular dimension or dimensions?

Anonymous
Not applicable
Author

I'm trying to remove the expression that's in my chart count({<Status={[Pended]}>}distinct ID) and add into my script as an If statement but it seems that's not the best approach and may not be possible. 

sunny_talwar

What are the dimensions you are using in the chart?