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: 
EllenBerden
Contributor
Contributor

if value of variable X is "", replace by value/count from variable Y

if value of “klant_nr” = 000000,

then


count(distinct %key_retail_customer_no)

as
count(distinct [Document No_])

 

How should i run this in the script?

Labels (1)
4 Replies
Anil_Babu_Samineni

Are you trying comparison? I am not understanding this part

as count(distinct [Document No_])

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
EllenBerden
Contributor
Contributor
Author

only when 

klant_nr = 000000

 

then i want

 

the count of variable "%key_retail_customer_no

 

to be replaced by

 

the count of variable "Document No_"

 

 

Anil_Babu_Samineni

You mean like this

If klant_nr=000000 THEN
Load distinct count(%key_retail_customer_no) as %key_retail_customer_no Resident XYZ;
Else
Load count("Document No_") as "Document No_" Resident ABC;
EndIf

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
QFabian
Specialist III
Specialist III

Hi @EllenBerden , here another option.

It makes an aggregation using count and group by, and a where clause to reduce the data.

 

Load

   your fields....,

   count(distinct %key_retail_customer_no)    as CountField

From YOURSOURCE

Where 

    klant_nr = 000000

Group By

   your fields....;

concatenate ///optional

Load

   your fields....,

  count(distinct [Document No_])   as CountField

From YOURSOURCE

Where 

    klant_nr <> 000000

Group By

   your fields....;

QFabian