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: 
Not applicable

if to set analysis

i need some help whit this IF.

I nedd change it to set analysis

'=Sum(IF((SEG='A' and DATE_REN<AddMonths(vFec-1, -1)),1,IF(SEG='ADMINISTRACIONES',0,IF(DATE_REN < vFec-1,1,0)))*IF(SALES>0,SALES,0))

4 Replies
ajsjoshua
Specialist
Specialist

Hi

pls put some sample.

Not applicable
Author

I believe its not possible to completely turned the expression into Set Analysis. But if you can add the new field on Sales with some filters in the script level, may we can write set analysis on UI.

Can you please post sample qvw ?

miguelbraga
Partner - Specialist III
Partner - Specialist III

To turn this expression in set analysis you need to add some flag fields with your if functions like this:

Flags_ETL:

LOAD

          IF(SALES>0,SALES,0)) as PositiveSales,

          IF(SEG='A', 1, 0) as FlagSeg,

          IF(DATE_REN<AddMonths(vFec-1, -1), 1, IF(DATE_REN < vFec-1, 1, 0)) as FlagDate,

Resident YourMainTable;

Then you can use a expression like this:

=sum({$<FlagSeg = {1}, FlagDate = {1}>} PositiveSales)

Regards,

MB

Not applicable
Author

May be vFec varibale is generated by user selections ?