5 Replies Latest reply: Jul 21, 2017 4:11 AM by Jose Miguel Vilaplana

# how to write if else condition

Hello All,

I am merging both expression by using or function is that correct  ,what it mean  is either one scenario is right then show spend,but I thinking the way I am merging is not correct ,because I am getting -1 as output of all the materials

Sum({<SCOPE={'Yes'},MATL_TYPE={'HALB','ROH'},New_Column={"=New_Column<>p_Material"}>}SPEND) or

Sum({<SCOPE={'Yes'},MATL_TYPE={'HALB','ROH'},New_Column={"=New_Column=p_Material"} ,p_Material={"=count(distinct Ip_ID)=1"}>}SPEND)

• ###### Re: how to write if else condition

Hi,

Why you don't merge both expressions in one single set analysis?

Sum({<SCOPE={'Yes'},MATL_TYPE={'HALB','ROH'},New_Column={"=New_Column<>p_Material"}> <SCOPE={'Yes'},MATL_TYPE={'HALB','ROH'},New_Column={"=New_Column=p_Material"} ,p_Material={"=count(distinct Ip_ID)=1"}>}SPEND

I think this will work

• ###### Re: how to write if else condition

Sorry, is with a "+"

Sum({<SCOPE={'Yes'},MATL_TYPE={'HALB','ROH'},New_Column={"=New_Column<>p_Material"}> + <SCOPE={'Yes'},MATL_TYPE={'HALB','ROH'},New_Column={"=New_Column=p_Material"} ,p_Material={"=count(distinct Ip_ID)=1"}>}SPEND)

• ###### Re: how to write if else condition

will + work same as or function,because i need either one expression is true then show spend

• ###### Re: how to write if else condition

Yes and i would ask you to read related stuff which "Set Analysis Operators in Qlikview"

• ###### Re: how to write if else condition

Hi,

This + work as an OR operator