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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikview979
Specialist
Specialist

Set Expression

Hi Experts,

How can i write set expression for below code

=count(DISTINCT if(len(GatePassDate)= 0,if(len([Repair Category])<> 0, BBND_ROs)))

regards

mahesh

Labels (1)
20 Replies
qlikview979
Specialist
Specialist
Author

Hi Bro,

I am getting correct count with my if condition, but i am trying to write in set expression

is it possible.

Regards

Kushal_Chawda
MVP
MVP

or

=Count({<BBND_ROs={"=len(GatePassDate)= 0 and len([Repair Category])<> 0"}>} distinct BBND_ROs)

Kushal_Chawda
MVP
MVP

As performance point of view, we should avoid the if conditions in expression, hence I suggested to move it in script instead

qlikview979
Specialist
Specialist
Author

Bro,

Its showing wrong count

Anil_Babu_Samineni
MVP
MVP

Can you try this may be in script, And FYI - I don't think whether you will get any performance issue using simple condition from your original post

Load GatePassDate,

     [Repair Category],

     BBND_ROs,

     if(len(GatePassDate)= 0,if(len([Repair Category])<> 0, 1,0) as Flag

Resident Table


And set analysis may be

Count({<Flag = {1}>}Distinct BBND_ROs)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Kushal_Chawda
MVP
MVP

Create one field in script

LOAD *,

         rowno() as Row

FROM table;

Now use this expression

=Count({<Row={"=len(GatePassDate)= 0 and len([Repair Category])<> 0"}>} distinct BBND_ROs)

qlikview979
Specialist
Specialist
Author

Ok Bro

Thanks

Anil_Babu_Samineni
MVP
MVP

Bhai, If we use Direct condition If(Condition1, If(Condition2..), Count(..)) this may gets performance. I wonder, How performance issue is involved when we write Count(...If(...If(...))).

Just want to know, Reply me if you feel to share

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
qlikview979
Specialist
Specialist
Author

Hi Bro,

i am using in Text object  and getting count 880  as per based on input.

Regards

tresB
Champion III
Champion III

Could you post your sample qvw?