Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
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

set analysis(using an if statement)

Hi,

Can some1 help me on this, my if statement seems to not be working

(Sum( {$<ScriptMonth={$(=concat('"' & CurrYearMonth & '"', ',' ))}>} if(vMeasures = 'SepPack','(Qty * SepPack)',$(vMeasures))))

if the measure is = 'SepPack' then the calculation is not correct

Thanks in Advance

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Remove the single quotes around your THEN branch:

Sum(

{$<ScriptMonth={$(=concat('"' & CurrYearMonth & '"', ',' ))}>}

     if(vMeasures = 'SepPack',

          (Qty * SepPack)                // removed single quotes here, you want the fields, not a literal

          ,$(vMeasures)    

     )

)

View solution in original post

4 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Try with the $ expansion:

(Sum( {$<ScriptMonth={$(=concat('"' & CurrYearMonth & '"', ',' ))}>} if($(vMeasures) = 'SepPack','(Qty * SepPack)',$(vMeasures))))


let me know

Not applicable
Author

I tried with that but it still doesnt work

swuehl
MVP
MVP

Remove the single quotes around your THEN branch:

Sum(

{$<ScriptMonth={$(=concat('"' & CurrYearMonth & '"', ',' ))}>}

     if(vMeasures = 'SepPack',

          (Qty * SepPack)                // removed single quotes here, you want the fields, not a literal

          ,$(vMeasures)    

     )

)

Not applicable
Author

Hi,

I removed single quotes  and its working, thanks