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: 
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
MVP
MVP

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....;

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.