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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
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

24 Replies
Anonymous
Not applicable
Author

My dimensions are, Status & ID. Count the # of ID when my status = pended.

I have about 30 other calculations that I need to create in the script. Keeping as simple as I can.

sunny_talwar

Would you be able to share a sample?

Anonymous
Not applicable
Author

In a straight table without expression embedded in the chart I would like to see.

See attached example. I need to see (distinct)totals for the two columns that I created TotalPend and TotalId

DESCRIPTIONIDSTATUSCOUNTstatusTOTALPENDS
TOTAL 7 4
FIVE5PENDING11
FOUR4DENIED10
ONE1PENDING11
SEVEN7PENDING11
SIX6APPROVED10
THREE3PENDING11
TWO2APPROVED10
Anonymous
Not applicable
Author

Added an example

sunny_talwar

Did you forget to add data to the table here?

Capture.PNG

Anonymous
Not applicable
Author

ADDED DATA

sunny_talwar

This?

Capture.PNG

Anonymous
Not applicable
Author

Yes but I do not want to create expressions. There's not a way to create in the script?

sunny_talwar

Looking for something like this?

Capture.PNG

Script:

TEST:

LOAD * Inline [

ID, DESCRIPTION, STATUS

1, ONE, PENDING

2, TWO, APPROVED

3, THREE, PENDING

4, FOUR, DENIED

5, FIVE, PENDING

6, SIX, APPROVED

7, SEVEN, PENDING

];

Join(TEST)

LOAD Count(STATUS) AS COUNTstatus

Resident TEST;

Join(TEST)

LOAD Count(STATUS) AS COUNTPENDS

Resident TEST

Where STATUS = 'PENDING';

Anonymous
Not applicable
Author

No, I assumed this would be a standard question but maybe I'm not being clear enough. I need what you have in your first example but without the expression in the chart. Is there not a way to create the expression in the script???