Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Specialist
Specialist

Condition not working

Hi all ,

My condition for set analysis for previous year is not working can you please suggest on this.

Below is the condition,

if((Sum({<Head = {'Bcone'},FlagNum = {"$(vAttriationFlagNum)"},Year={'$(=(max(Year)-1))'},Month_Num={'<=$(=max(Month_Num))'}>}Attrition))

=0,

((Sum({<Head = {'Bcone'},FlagNum = {"$(vAttriationFlagNum)"},Year={'$(=(max(Year)-2))'},Month_Num={'<=$(=max(Month_Num))'}>}Attrition))),

((Sum({<Head = {'Bcone'},FlagNum = {"$(vAttriationFlagNum)"},Year={'$(=(max(Year)-1))'},Month_Num={'<=$(=max(Month_Num))'}>}Attrition)))))

6 Replies
Highlighted
Champion II
Champion II

Re: Condition not working

if((Sum({<Head = {'Bcone'},FlagNum = {"=$(vAttriationFlagNum)"},Year={'$(=(max(Year)-1))'},

Month_Num={"<=$(=max(Month_Num))"}>}Attrition))

Highlighted
Champion II
Champion II

Re: Condition not working

i think you can also try Year without ' quotes Year={$(=(max(Year)-1))}

Highlighted
Specialist
Specialist

Re: Condition not working

Hi Vineeth,

Month_num is still  not working

thanks

Highlighted
Champion II
Champion II

Re: Condition not working

Strange, does max(Month_Num) evaluate correctly in a text box? ARE both Numeric fields?

try below :

if(Sum({<Head = {'Bcone'},FlagNum = {"=$(vAttriationFlagNum)"},Year={$(=(max(Year)-1))}

,Month_Num={"<=$(=max(Month_Num))"}>}Attrition)=0,  //Then

Sum({<Head = {'Bcone'},FlagNum = {"=$(vAttriationFlagNum)"},Year={'$(=(max(Year)-2))'}

,Month_Num={"<=$(=max(Month_Num))"}>}Attrition),    //Else

Sum({<Head = {'Bcone'},FlagNum = {"=$(vAttriationFlagNum)"},Year={'$(=(max(Year)-1))'},

Month_Num={"<=$(=max(Month_Num))"}>}Attrition)

)

Highlighted
Specialist
Specialist

Re: Condition not working

Hi All,

Year={'$(=(max(Year)-1))'} is not working in set analysis here



Thanks

Highlighted
Champion III
Champion III

Re: Condition not working

Try this:

Year = { $(= max(Year)-1)) }