Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
tabisen1
Contributor II
Contributor II

How to using the Condition function with the Set Analysis

Hi,

Can Any one tell me that how can i use the below function in the Set Analysis the coding I am using as below. 

Prorate Coding for monthly target =     if(date(vToday)=date(vToday) and date(vToday)<=monthend,sum((Del_Target)/Del_No_Day)*(day(vToday)-1),sum((Del_Target)/Del_No_Day)*day(monthend))

Actual sales Quantity = sum(QTY)

Below set is working but it capture the total monthly target rather then the prorate target.

Set Analysis= Count({$<[Parent Code]={'=sum(QTY)/(Monthly_Target)'}>} DISTINCT [Parent Code])

# Replacing the {'=sum(QTY)/(Del_Target)'} by  = sum(QTY) / if(date(vToday)=date(vToday) and date(vToday)<=monthend,sum((Del_Target)/Del_No_Day)*(day(vToday)-1),sum((Del_Target)/Del_No_Day)*day(monthend))

Please suggest how to use the Prorate Target rather then Monthly_ Target.

6 Replies
Not applicable

INsert the cndition function in a variable, and use the variale in set analysis.

tabisen1
Contributor II
Contributor II
Author

Dear Mario,

# Replacing the {'=sum(QTY)/(Del_Target)'} by  = sum(QTY) / if(date(vToday)=date(vToday) and date(vToday)<=monthend,sum((Del_Target)/Del_No_Day)*(day(vToday)-1),sum((Del_Target)/Del_No_Day)*day(monthend))


In the above expression i am using the Variable i.e. vToday.


Table fields

Del_No_Day

Del_Target

QTY


Can u explain me in details how to create the prorate variable

Not applicable

vCondition=

sum(QTY) / if(date(vToday)=date(vToday) and date(vToday)<=monthend,sum((Del_Target)/Del_No_Day)*(day(vToday)-1),sum((Del_Target)/Del_No_Day)*day(monthend))


and Replacing the {'=sum(QTY)/(Del_Target)'} by {$(vCondition)}

tabisen1
Contributor II
Contributor II
Author

Mario,

I am getting the below error while Loading.

Aggregation expressions not allowed in GROUP BY clause

Let VCondition= sum(QTY) / if(date(vToday)=date(vToday) and date(vToday)<=monthend,

sum((Del_Target)/Del_No_Day)*(day(vToday)-1),sum((Del_Target)/Del_No_Day)*day(monthend))

their are two table in one table the Monthly Target and other table the Quantity.

to join two table i have created a key.

dirk_konings
Creator III
Creator III

you can't use this in scripting

for scripting each user field should be in the same table.

Why do you wan't to do this in scripting and not via an expression in a straight table ?


Dirk

Not applicable

My instructions are not for scripting, but for use in presentation...in scripting you can't use it!