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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

Help in set analysis

Dears got the following data

LOAD * Inline [

DEFECT_ID, DEV_PLAN_ID, STATUS, DATA_SOURCE

X,1,TESTED,CRM

X,2, CANCELLED, CRM

X,1,NOT TESTED, DW

X,2, CANCELLED, DW

];

I have a pivot table with the two dimensions Defect_id, and Dev_plan_id

but what I want to show is the Status of the CRM data source when the the DW data source of the same defect id and dev plan id has a different status

i.e.

the pivot table will be showing from the above data the following

X, 1, TESTED

I put the following expression

only(AGGR(ONLY({<DATA_SOURCE={'CRM'}, DEFECT_ID={"=COUNT(DISTINCT STATUS)>1"}>} STATUS),DEFECT_ID,DEV_PLAN_ID))

but I got X,1, tested

               2, Cancelled

PLEASE ADVISE

I can walk on water when it freezes
8 Replies
NickHoff
Specialist
Specialist

You wouldn't use set analysis for this expression because there is no aggregation being performed.  What you could do is an if statement.

=IF(DEFECT_ID =- DEV_PLAN_ID, STATUS = 'TESTED', 'CANCELED')

ali_hijazi
Partner - Master II
Partner - Master II
Author

no I can't use if because I have plenty of statuses

this is a sample data that I showed

I can walk on water when it freezes
maxgro
MVP
MVP

maybe

if(max(aggr(count (distinct STATUS), DEFECT_ID, DEV_PLAN_ID))>1,

only({$ <DATA_SOURCE={CRM}>} STATUS)

)

NickHoff
Specialist
Specialist

  I dont' understand your logic behind the status, but If you nest your if statements with the correct logic for the status it should work.

=IF(DEFECT_ID =- DEV_PLAN_ID AND DATA_SOURCE = 'CRM' , STATUS = 'TESTED', 'CANCELED'),

=IF(DEFECT_ID =- DEV_PLAN_ID AND DATA_SOURCE = 'DW' , STATUS = 'NOT TESTED', 'CANCELED'),

*/Else Statement

gmoraleswit
Partner - Creator II
Partner - Creator II

try this:

if(Only({$<DATA_SOURCE={'CRM'}>} STATUS) <> Only({$<DATA_SOURCE-={'CRM'}>} STATUS), Only({$<DATA_SOURCE={'CRM'}>} STATUS),null())

ali_hijazi
Partner - Master II
Partner - Master II
Author

I tried this but it gave me allocated memory exceeded for the chart

I can walk on water when it freezes
ali_hijazi
Partner - Master II
Partner - Master II
Author

that's why I'm trying to avoid if else statement

I can walk on water when it freezes
gmoraleswit
Partner - Creator II
Partner - Creator II

Here is another solution,

I created a key field with DEFECT_ID and DEV_PLAN_ID and use this field in the expression:


only({$<DATA_SOURCE={'CRM'},key={"=count(distinct STATUS)>1"}>} STATUS)

see attach