Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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

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

or

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

Kushal_Chawda

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

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

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

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

tresesco
MVP
MVP

Could you post your sample qvw?