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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
klrameet
Contributor III
Contributor III

Finding out values using multiple conditions for a chart

Hi @petter , @Nicole-Smith , @Gysbert_Wassenaar 

I am trying to plot a tree map using below values in a table and color it using expression.

But the problem i am running is that i need to plot status only for the given cob date and Name combination, where Version and Run Date are maximum from the available values and Type = Batch.

With my current expression, its taking both C & F values for 29-Mar-2019 - David instead of just getting (COB= 29-Mar-2019, Version = 16, Run Date = 5-Jul-2019, Name = David, Type = Batch)

COBVerRun DateNameTypeStatus
29-Mar-19165-Jul-19DavidBatchC
29-Mar-19165-Jul-19DavidBatchC
29-Mar-19165-Jul-19DavidBatchC
29-Mar-19154-Jul-19DavidBatchC
29-Mar-19113-Jul-19DavidBatchC
28-Mar-19104-Jul-19DavidAdhocF
28-Mar-19103-Jul-19DavidBatchF

 

Basically how do i get this from above .. 

Status
C

 

(Basically, trying to understand, how do i write expression for something like ... 

Select distinct status from TABLE

where COB= max(cob) and Version = max(version) and Run Date = max(run Date) and Type = Batch

 

 

Labels (3)
1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

You can create a table in Qlik Sense and add a single measure with this expression (and no dimensions):

Only(DISTINCT
{<
COB={'$(=Date(Max(COB)))'}
,Ver={$(=Max(Ver))}
,[Run Date]={'$(=Date(Max([Run Date])))'}
,Type={'Batch'}
>}
Status
)

 

This also seems to work:

Concat( DISTINCT
{<Ver={"=Ver=$(=Max(Ver)) AND COB='$(=Date(Max(COB)))' AND [Run Date]='$(=Date(Max([Run Date])))' AND Type='Batch'"
}>}
Status)

View solution in original post

5 Replies
bharathadde
Creator II
Creator II

if below is my data

COB,Ver,RunDate ,Name,Type,Status
3/29/2019,16,7/5/2019,David,Batch,C
3/29/2019,16,7/5/2019,David,Batch,C
3/29/2019,16,7/5/2019,David,Batch,C
3/29/2019,15,7/4/2019,David,Batch,C
3/29/2019,11,7/3/2019,David,Batch,C
3/28/2019,10,7/4/2019,David,Adhoc,F
3/28/2019,10,7/3/2019,David,Batch,F

this is what i did on Straight table chart

used COB,Ver,RunDate ,Name,Type as dimensions and Status as expression

COB --> =Aggr(Date(max(COB)),Name)

Ver --> =Aggr(max(Ver),Name)

RunDate --> =Aggr(Date(max(RunDate)),Name)

Name --> Name

Type --> Type

Expressions: 

Status --> Status 

Result I attached to this message

petter
Partner - Champion III
Partner - Champion III

You can create a table in Qlik Sense and add a single measure with this expression (and no dimensions):

Only(DISTINCT
{<
COB={'$(=Date(Max(COB)))'}
,Ver={$(=Max(Ver))}
,[Run Date]={'$(=Date(Max([Run Date])))'}
,Type={'Batch'}
>}
Status
)

 

This also seems to work:

Concat( DISTINCT
{<Ver={"=Ver=$(=Max(Ver)) AND COB='$(=Date(Max(COB)))' AND [Run Date]='$(=Date(Max([Run Date])))' AND Type='Batch'"
}>}
Status)

klrameet
Contributor III
Contributor III
Author

@petter  .. thanks for this .. I tried the expressions 

=Only(DISTINCT
{<
 [FEED_REPORT_STATUS_LOG_QV.COB_DATE]={'$(=Date(Max([FEED_REPORT_STATUS_LOG_QV.COB_DATE])))'}
,[FEED_REPORT_STATUS_LOG_QV.VERSION_NO]={'$(=Max([FEED_REPORT_STATUS_LOG_QV.VERSION_NO]))'}
,[FEED_REPORT_STATUS_LOG_QV.RUN_DATE]={'$(=Date(Max([FEED_REPORT_STATUS_LOG_QV.RUN_DATE])))'}
,[FEED_REPORT_STATUS_LOG_QV.EVENT_TYPE]={'Batch'}
>}
[FEED_REPORT_STATUS_LOG_QV.STATUS]
)

but getting invalid dimension error ..  😐

petter
Partner - Champion III
Partner - Champion III

I tried the expressions I supplied with test data on my own and it worked well for me. If you want me to help me please provide a sample application. The error message doesn't seem to indicate a problem with the expressions unless you put them into a dimension and not a measure... could you please check that you use the expressions as measures?

petter
Partner - Champion III
Partner - Champion III

Please click like if you find any answer helpful as this is the only way you can give "real credit" on this forum. 🙂