Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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_])

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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